diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php
index 87281e7ea63..cdeacefafe1 100644
--- a/htdocs/comm/propal/apercu.php
+++ b/htdocs/comm/propal/apercu.php
@@ -47,8 +47,9 @@ $result = restrictedArea($user, 'propal', $id);
* View Mode
*/
-llxHeader();
+$form = new Form($db);
+llxHeader();
if ($id > 0 || ! empty($ref))
{
@@ -68,10 +69,12 @@ if ($id > 0 || ! empty($ref))
*/
print '
';
- // Ref
- print '| '.$langs->trans('Ref').' | ';
- print ''.$object->ref.' | ';
- print '
';
+ $linkback = '' . $langs->trans("BackToList") . '';
+
+ // Ref
+ print '| ' . $langs->trans('Ref') . ' | ';
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
+ print ' |
';
// Ref client
print '| '.$langs->trans('RefCustomer').' | ';
@@ -144,7 +147,7 @@ if ($id > 0 || ! empty($ref))
print "
\n";
// Conversion du PDF en image png si fichier png non existant
- if (! file_exists($fileimage) && ! file_exists($fileimagebis))
+ if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{
if (class_exists("Imagick"))
{
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index d28e9b42c9c..4d632a84c54 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -2099,26 +2099,26 @@ class Propal extends CommonObject
$this->fetchObjectLinked($id,$this->element);
foreach($this->linkedObjectsIds as $objecttype => $objectid)
{
- $numi=count($objectid);
- for ($i=0;$i<$numi;$i++)
+ // Nouveau système du comon object renvoi des rowid et non un id linéaire de 1 à n
+ // On parcourt donc une liste d'objets en tant qu'objet unique
+ foreach($objectid as $key => $object)
{
// Cas des factures liees directement
if ($objecttype == 'facture')
{
- $linkedInvoices[] = $objectid[$i];
+ $linkedInvoices[] = $object;
}
// Cas des factures liees par un autre objet (ex: commande)
else
{
- $this->fetchObjectLinked($objectid[$i],$objecttype);
+ $this->fetchObjectLinked($object,$objecttype);
foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid)
{
- $numj=count($subobjectid);
- for ($j=0;$j<$numj;$j++)
+ foreach($subobjectid as $subkey => $subobject)
{
if ($subobjecttype == 'facture')
{
- $linkedInvoices[] = $subobjectid[$j];
+ $linkedInvoices[] = $subobject;
}
}
}
diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php
index f3d83b837dd..1ec3a0533cc 100644
--- a/htdocs/commande/apercu.php
+++ b/htdocs/commande/apercu.php
@@ -47,6 +47,8 @@ $result=restrictedArea($user,'commande',$id,'');
* View Mode
*/
+$form = new Form($db);
+
llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
if ($id > 0 || ! empty($ref))
@@ -64,9 +66,12 @@ if ($id > 0 || ! empty($ref))
print '';
- // Ref
- print '| '.$langs->trans("Ref")." | ";
- print ''.$object->ref.' |
';
+ //$linkback = '' . $langs->trans("BackToList") . '';
+
+ // Ref
+ print '| ' . $langs->trans('Ref') . ' | ';
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
+ print ' |
';
// Ref cde client
print '| '.$langs->trans('RefCustomer').' | ';
@@ -142,7 +147,7 @@ if ($id > 0 || ! empty($ref))
print "
\n";
// Conversion du PDF en image png si fichier png non existant
- if (! file_exists($fileimage) && ! file_exists($fileimagebis))
+ if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{
if (class_exists("Imagick"))
{
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 9e0875914df..5105f8196d1 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1790,6 +1790,9 @@ if (empty($reshook))
dol_print_error($db);
}
}
+
+ if ($error)
+ $action = 'edit_extras';
}
}
diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php
index 340df8172dc..1172769e95a 100644
--- a/htdocs/compta/facture/apercu.php
+++ b/htdocs/compta/facture/apercu.php
@@ -29,6 +29,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@@ -79,10 +80,21 @@ if ($id > 0 || ! empty($ref))
*/
print '';
- // Ref
- print '| '.$langs->trans('Ref').' | ';
- print ''.$object->ref.' | ';
- print '
';
+ $linkback = '' . $langs->trans("BackToList") . '';
+
+ // Ref
+ print '| ' . $langs->trans('Ref') . ' | ';
+ $morehtmlref = '';
+ $discount = new DiscountAbsolute($db);
+ $result = $discount->fetch(0, $object->id);
+ if ($result > 0) {
+ $morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
+ }
+ if ($result < 0) {
+ dol_print_error('', $discount->error);
+ }
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
+ print ' |
';
// Ref customer
print '| '.$langs->trans('RefCustomer').' | ';
@@ -280,7 +292,7 @@ if ($id > 0 || ! empty($ref))
print "
\n";
// Conversion du PDF en image png si fichier png non existant
- if (! file_exists($fileimage) && ! file_exists($fileimagebis))
+ if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{
if (class_exists("Imagick"))
{
diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php
index af975a39751..780598fc073 100644
--- a/htdocs/compta/sociales/charges.php
+++ b/htdocs/compta/sociales/charges.php
@@ -79,7 +79,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
{
$dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
- $amount=GETPOST('amount');
+ $amount=price2num(GETPOST('amount'));
$actioncode=GETPOST('actioncode');
if (! $dateech)
{
@@ -114,7 +114,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
$chargesociales->lib=GETPOST('label');
$chargesociales->date_ech=$dateech;
$chargesociales->periode=$dateperiod;
- $chargesociales->amount=price2num($amount);
+ $chargesociales->amount=$amount;
$id=$chargesociales->create($user);
if ($id <= 0)
@@ -130,7 +130,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
{
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
- $amount=GETPOST('amount');
+ $amount=price2num(GETPOST('amount'));
if (! $dateech)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
@@ -146,7 +146,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'edit';
}
- else
+ elseif (! is_numeric($amount))
+ {
+ setEventMessage($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), 'errors');
+ $action = 'create';
+ }
+ else
{
$chargesociales=new ChargeSociales($db);
$result=$chargesociales->fetch($id);
diff --git a/htdocs/fichinter/apercu.php b/htdocs/fichinter/apercu.php
index 89efad03841..899ecaf9805 100644
--- a/htdocs/fichinter/apercu.php
+++ b/htdocs/fichinter/apercu.php
@@ -72,13 +72,21 @@ if ($id > 0 || ! empty($ref))
*/
print '';
- // Ref
- print '| '.$langs->trans("Ref")." | ";
- print ''.$object->ref.' | ';
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ // Ref
+ print '
| '.$langs->trans("Ref").' | ';
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
+ print ' |
';
- $nbrow=4;
+ $nbrow=3;
+ // Client
+ print "| ".$langs->trans("Customer")." | ";
+ print '';
+ print ''.$soc->name.'';
+ print ' | ';
print '';
-
+
/*
* Documents
*/
@@ -124,7 +132,7 @@ if ($id > 0 || ! empty($ref))
print " |
\n";
// Conversion du PDF en image png si fichier png non existant
- if (! file_exists($fileimage) && ! file_exists($fileimagebis))
+ if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{
if (class_exists("Imagick"))
{
@@ -141,21 +149,14 @@ if ($id > 0 || ! empty($ref))
print "";
- // Client
- print "| ".$langs->trans("Customer")." | ";
- print '';
- print ''.$soc->name.'';
- print ' | ';
- print '
';
-
// Statut
print '| '.$langs->trans("Status").' | ';
- print "".$object->getLibStatut(4)." | \n";
+ print "".$object->getLibStatut(4)." | \n";
print '
';
// Date
print '| '.$langs->trans("Date").' | ';
- print "".dol_print_date($object->datec,"daytext")." | \n";
+ print "".dol_print_date($object->datec,"daytext")." | \n";
print '
';
print '';
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index f6a3dfb08c8..35308ef7e0d 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -464,6 +464,7 @@ class CommandeFournisseur extends CommonOrder
{
$result = 1;
$this->log($user, 1, time()); // Statut 1
+ $this->statut = 1;
$this->ref = $num;
}
diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php
index bfa6d8f582a..5af112ebfa0 100644
--- a/htdocs/public/opensurvey/studs.php
+++ b/htdocs/public/opensurvey/studs.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2014 Marcos García
+/* Copyright (C) 2013-2015 Laurent Destailleur
+ * Copyright (C) 2014 Marcos García
*
* 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
@@ -46,7 +46,7 @@ if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage);
$nblignes=$object->fetch_lines();
//If the survey has not yet finished, then it can be modified
-$canbemodified = ($object->date_fin > dol_now());
+$canbemodified = (empty($object->date_fin) || $object->date_fin > dol_now());
/*
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index d0d6b1a2a21..21de67bfcf7 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2438,6 +2438,7 @@ class Societe extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
+ $this->parent = $id;
return 1;
}
else
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 814d61e5be9..9fa6e117279 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -680,6 +680,7 @@ if (empty($reshook))
// Set parent company
if ($action == 'set_thirdparty' && $user->rights->societe->creer)
{
+ $object->fetch($socid);
$result = $object->set_parent(GETPOST('editparentcompany','int'));
}