';
+
+ // Propals
+ if($user->rights->propale->creer)
{
- print "".'| ';
- print_titre($langs->trans("AddToMyProposals")) . ' | ';
- print '';
- print_titre($langs->trans("AddToOtherProposals")) . ' | ';
- print '
';
+ $langs->load("propal");
+
+ print '| ';
+ print_titre($langs->trans("AddToMyProposals")) . ' | ';
+ print '';
+ print_titre($langs->trans("AddToOtherProposals")) . ' | ';
+ print '
';
- print "".'';
- $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.ref,".$db->pdate("p.datep")." as dp";
- $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
- $sql .=" WHERE p.fk_soc = s.idp AND p.fk_statut = 0 AND p.fk_user_author = ".$user->id;
- $sql .= " ORDER BY p.datec DESC, tms DESC";
-
- if ( $db->query($sql) )
- {
- $num = $db->num_rows();
- $i = 0;
- print '';
- $var=True;
- while ($i < $num)
- {
- $objp = $db->fetch_object($i);
- $var=!$var;
- print "";
- print "| propalid\">$objp->ref | \n";
- print "idp\">$objp->nom | \n";
- print "". strftime("%d %b",$objp->dp)." | \n";
- print ' ';
- $i++;
- }
- print " ";
- $db->free();
- }
+ // Liste de "Mes propals"
+ print ' |
| ';
+ $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.ref,".$db->pdate("p.datep")." as dp";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
+ $sql .=" WHERE p.fk_soc = s.idp AND p.fk_statut = 0 AND p.fk_user_author = ".$user->id;
+ $sql .= " ORDER BY p.datec DESC, tms DESC";
- print ' | ';
- print '';
+ $result=$db->query($sql);
+ if ($result)
+ {
+ $num = $db->num_rows($result);
+ if ($num) {
+ $i = 0;
+ print '';
+ $var=true;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($result);
+ $var=!$var;
+ print '';
+ $i++;
+ }
+ print " ";
+ }
+ else {
+ print $langs->trans("NoOpenedPropals");
+ }
+ $db->free($result);
+ }
- $otherprop = $propal->liste_array(1, '<>'.$user->id);
- if (sizeof($otherprop))
- {
- print '';
- }
- print ' | ';
+ print '';
- print '
';
+ // Liste de "Other propals"
+ print '';
+
+ $otherprop = $propal->liste_array(1, ' <> s'.$user->id);
+ if (is_array($otherprop) && sizeof($otherprop))
+ {
+ $var=false;
+ print '';
+ }
+ else {
+ print $langs->trans("NoOtherOpenedPropals");
+ }
+ print ' | ';
+
+ print '';
}
- if($user->rights->facture->creer)
+ // Factures
+ if($user->rights->facture->creer)
{
- $langs->load("bills");
+ $langs->load("bills");
- print "".'| ';
- print_titre($langs->trans("AddToMyBills"));
- print ' | ';
- print_titre($langs->trans("AddToOtherBills"));
- print ' |
';
+ print '| ';
+ print_titre($langs->trans("AddToMyBills"));
+ print ' | ';
+ print_titre($langs->trans("AddToOtherBills"));
+ print ' |
';
- print "".'';
- $sql = "SELECT s.nom, s.idp, f.rowid as factureid, f.facnumber,".$db->pdate("f.datef")." as df";
- $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
- $sql .=" WHERE f.fk_soc = s.idp AND f.fk_statut = 0 AND f.fk_user_author = ".$user->id;
- $sql .= " ORDER BY f.datec DESC, f.rowid DESC";
-
- if ( $db->query($sql) )
- {
- $num = $db->num_rows();
- $i = 0;
- print '';
- $var=True;
- while ($i < $num)
- {
- $objp = $db->fetch_object( $i);
-
- $var=!$var;
- print "";
- print "| factureid\">$objp->facnumber | \n";
- print "idp\">$objp->nom | \n";
- print "". strftime("%d %b",$objp->df)." | \n";
- print ' ';
- $i++;
- }
- print " ";
- $db->free();
- }
- else
- {
- dolibarr_print_error($db);
- }
- print ' | ';
- // \todo Ajouter liste des factures autres
- print ' |
';
+ // Liste de Mes factures
+ print '';
+ $sql = "SELECT s.nom, s.idp, f.rowid as factureid, f.facnumber,".$db->pdate("f.datef")." as df";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
+ $sql .=" WHERE f.fk_soc = s.idp AND f.fk_statut = 0 AND f.fk_user_author = ".$user->id;
+ $sql .= " ORDER BY f.datec DESC, f.rowid DESC";
+
+ $result=$db->query($sql);
+ if ($result)
+ {
+ $num = $db->num_rows($result);
+ if ($num) {
+ $i = 0;
+ print '';
+ $var=true;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($result);
+
+ $var=!$var;
+ print '';
+ $i++;
+ }
+ print " ";
+ }
+ else {
+ print $langs->trans("NoBills");
+ }
+ $db->free($result);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+
+ print ' | ';
+
+ // Liste de Autres factures
+ $var=true;
+
+ $sql = "SELECT s.nom, s.idp, f.rowid as factureid, f.facnumber,".$db->pdate("f.datef")." as df";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
+ $sql .=" WHERE f.fk_soc = s.idp AND f.fk_statut = 0 AND f.fk_user_author <> ".$user->id;
+ $sql .= " ORDER BY f.datec DESC, f.rowid DESC";
+
+ $result=$db->query($sql);
+ if ($result)
+ {
+ $num = $db->num_rows($result);
+ if ($num) {
+ $i = 0;
+ print '';
+ $var=true;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($result);
+
+ $var=!$var;
+ print '';
+ $i++;
+ }
+ print " ";
+ }
+ else {
+ print $langs->trans("NoOtherBills");
+ }
+ $db->free($result);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+
+ print ' |
';
}
+
+ print '