diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 739d56abcf7..c466fc5d8b2 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -249,8 +249,7 @@ if ($resql)
$action->userdone->id=$obj->fk_user_done;
// Defined date_start_in_calendar and date_end_in_calendar property
- // They are date start and end of action but modified to not be outside
- // calendar view.
+ // They are date start and end of action but modified to not be outside calendar view.
if ($action->percentage <= 0)
{
$action->date_start_in_calendar=$action->datep;
@@ -269,37 +268,43 @@ if ($resql)
$action->ponctuel=1;
}
- if ($action->date_start_in_calendar < $firstdaytoshow) $action->date_start_in_calendar=$firstdaytoshow;
- if ($action->date_end_in_calendar > $lastdaytoshow) $action->date_end_in_calendar=$lastdaytoshow;
-
- // Add an entry in actionarray for each day
- $daycursor=$action->date_start_in_calendar;
- $annee = date('Y',$daycursor);
- $mois = date('m',$daycursor);
- $jour = date('d',$daycursor);
-
- // Loop on each day covered by action to prepare an index to show on calendar
- $loop=true; $j=0;
- $daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
- do
+ // Check values
+ if ($action->date_end_in_calendar < $firstdaytoshow ||
+ $action->date_start_in_calendar > $lastdaytoshow)
{
- //if ($action->id==408) print 'daykey='.$daykey.' '.$action->datep.' '.$action->datef.'
';
-
- //if ($action->datef && $action->datef == $daykey && $action->datep < $action->datef)
- //{ // We discard such index. This means it's end of a range ending on last day + 1 at 00:00:00.
- //}
- //else
- //{
- $actionarray[$daykey][]=$action;
- $j++;
- //}
- $daykey+=60*60*24;
- if ($daykey > $action->date_end_in_calendar) $loop=false;
+ // This record is out of visible range
+ }
+ else
+ {
+ if ($action->date_start_in_calendar < $firstdaytoshow) $action->date_start_in_calendar=$firstdaytoshow;
+ if ($action->date_end_in_calendar > $lastdaytoshow) $action->date_end_in_calendar=$lastdaytoshow;
+
+ // Add an entry in actionarray for each day
+ $daycursor=$action->date_start_in_calendar;
+ $annee = date('Y',$daycursor);
+ $mois = date('m',$daycursor);
+ $jour = date('d',$daycursor);
+
+ // Loop on each day covered by action to prepare an index to show on calendar
+ $loop=true; $j=0;
+ $daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
+ do
+ {
+ //if ($action->id==408) print 'daykey='.$daykey.' '.$action->datep.' '.$action->datef.'
';
+
+ $actionarray[$daykey][]=$action;
+ $j++;
+
+ $daykey+=60*60*24;
+ if ($daykey > $action->date_end_in_calendar) $loop=false;
+ }
+ while ($loop);
+
+ //print 'Event '.$i.' id='.$action->id.' (start='.dol_print_date($action->datep).'-end='.dol_print_date($action->datef);
+ //print ' startincalendar='.dol_print_date($action->date_start_in_calendar).'-endincalendar='.dol_print_date($action->date_end_in_calendar).') was added in '.$j.' different index key of array
';
}
- while ($loop);
$i++;
- //print 'Event '.$i.' id='.$action->id.' (start='.dol_print_date($action->datep).'-end='.dol_print_date($action->datef).') was added in '.$j.' different index days in array
';
}
}
else
@@ -405,14 +410,15 @@ if ($_GET["action"] != 'show_day') // View by month
}
echo " \n";
- // In loops, tmpday contains day nb in current month (can be negative for days of previous month)
+ // In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month)
+ //var_dump($actionarray);
+ //print $tmpday;
for($iter_week = 0; $iter_week < 6 ; $iter_week++)
{
echo "
\n";
for($iter_day = 0; $iter_day < 7; $iter_day++)
{
- /* Show days before the beginning of the current month
- (previous month) */
+ /* Show days before the beginning of the current month (previous month) */
if($tmpday <= 0)
{
$style='cal_other_month';
diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php
index ffb610747db..61efdf5a973 100644
--- a/htdocs/comm/fiche.php
+++ b/htdocs/comm/fiche.php
@@ -406,13 +406,11 @@ if ($socid > 0)
{
$var=true;
$num = $db->num_rows($resql);
- if ($num > 0)
- {
- print '
';
- print ' | ';
- print '
';
- $var=!$var;
- }
+
+ print '';
+ print ' | ';
+ print '
';
+
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
@@ -460,12 +458,11 @@ if ($socid > 0)
{
$var=true;
$num = $db->num_rows($resql);
- if ($num >0 )
- {
- print '';
- print ' | ';
- print '
';
- }
+
+ print '';
+ print ' | ';
+ print '
';
+
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 50ac7959e67..4d1237245fd 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -65,7 +65,7 @@ class Propal extends CommonObject
var $datec; // Date of creation
var $datev; // Date of validation
var $date; // Date of proposal
- var $datep; // Duplicate with date
+ var $datep; // Same than date
var $date_livraison;
var $fin_validite;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index f61131ffd02..61837d758e9 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2078,7 +2078,7 @@ class Facture extends CommonObject
/**
* \brief Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle lon
- * \param alreadypaid 0=Not payment already done, 1=Some payments already done
+ * \param alreadypaid 0=No payment already done, 1=Some payments already done
* \return string Libelle
*/
function getLibStatut($mode=0,$alreadypaid=-1)
diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php
index 6d57c36a06f..2cd5387ae21 100644
--- a/htdocs/compta/fiche.php
+++ b/htdocs/compta/fiche.php
@@ -306,11 +306,13 @@ if ($socid > 0)
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,';
$sql.= ' f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut,';
$sql.= ' s.nom, s.rowid as socid,';
- $sql.= ' sum(pf.amount) as am';
+ $sql.= ' SUM(pf.amount) as am';
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
- $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.total_ttc, f.datef, f.datec, f.paye, f.fk_statut, s.nom, s.rowid';
+ $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,';
+ $sql.= ' f.datef, f.datec, f.paye, f.fk_statut,';
+ $sql.= ' s.nom, s.rowid';
$sql.= " ORDER BY f.datef DESC, f.datec DESC";
$resql=$db->query($sql);
diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php
index 48cafd745e5..425a91d440e 100644
--- a/htdocs/fourn/class/fournisseur.class.php
+++ b/htdocs/fourn/class/fournisseur.class.php
@@ -216,29 +216,28 @@ class Fournisseur extends Societe
}
/**
- * \brief Cr�� une categorie fournisseur
- * \param user Utilisateur qui cr�e
- * \param name Nom categorie
- * \return int <0 si ko, 0 si ok
+ * \brief Create a supplier category
+ * \param user User asking creation
+ * \param name Nom categorie
+ * \return int <0 si ko, 0 si ok
*/
function CreateCategory($user, $name)
{
- dol_syslog("Fournisseur::CreateCategory");
-
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label,visible,type)";
$sql.= " VALUES ";
$sql.= " ('".addslashes($name)."',1,1)";
- $result = $this->db->query($sql);
-
- if ($result == 1)
+ dol_syslog("Fournisseur::CreateCategory sql=".$sql);
+ $resql = $this->db->query($sql);
+ if ($resql)
{
dol_syslog("Fournisseur::CreateCategory : Success");
return 0;
}
else
{
- dol_syslog("Fournisseur::CreateCategory : Failed (".$this->db->error().")");
+ $this->error=$this->db->lasterror();
+ dol_syslog("Fournisseur::CreateCategory : Failed (".$this->error.")");
return -1;
}
}
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index d523ca0f330..6059c31c746 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -623,6 +623,7 @@ else
$html->select_date($fac->datep,'','','','',"update",1,1);
print '';
+ // Due date
print '| '.$langs->trans('DateEcheance').' | ';
$html->select_date($fac->date_echeance,'ech','','','',"update",1,1);
if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
@@ -875,7 +876,7 @@ else
print ' |
';
print '| '.$langs->trans('DateEcheance').' | ';
print dol_print_date($fac->date_echeance,'daytext');
- if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
+ if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
print ' |
';
// Status
diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php
index 35f0a71dfed..6d7499fbde3 100644
--- a/htdocs/fourn/fiche.php
+++ b/htdocs/fourn/fiche.php
@@ -191,7 +191,7 @@ if ( $societe->fetch($socid) )
print '';
print '';
print '';
- print '| '.$langs->trans("LastOrders",($num<$MAXLIST?$num:$MAXLIST)).' | ';
+ print '';
print ' ';
while ($i < $num && $i <= $MAXLIST)
@@ -234,10 +234,13 @@ if ( $societe->fetch($socid) )
if ($user->rights->fournisseur->facture->lire)
{
- $sql = 'SELECT p.rowid,p.libelle,p.facnumber,p.fk_statut, p.datef as df, total_ttc as amount, paye';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as p';
- $sql.= ' WHERE p.fk_soc = '.$societe->id;
- $sql.= ' ORDER BY p.datef DESC';
+ $sql = 'SELECT f.rowid,f.libelle,f.facnumber,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,';
+ $sql.= ' SUM(pf.amount) as am';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
+ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn';
+ $sql.= ' WHERE f.fk_soc = '.$societe->id;
+ $sql.= ' GROUP BY f.rowid,f.libelle,f.facnumber,f.fk_statut,f.datef,f.total_ttc,f.paye';
+ $sql.= ' ORDER BY f.datef DESC';
$resql=$db->query($sql);
if ($resql)
{
@@ -258,7 +261,9 @@ if ( $societe->fetch($socid) )
print img_object($langs->trans('ShowBill'),'bill').' '.$obj->facnumber.' '.dol_trunc($obj->libelle,14).'';
print ''.dol_print_date($db->jdate($obj->df),'day').' | ';
print ''.price($obj->amount).' | ';
- print ''.$facturestatic->LibStatut($obj->paye,$obj->fk_statut,5).' | ';
+ print '';
+ print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$obj->am);
+ print ' | ';
print '';
$i++;
}
|