diff --git a/htdocs/includes/modules/modPropale.class.php b/htdocs/includes/modules/modPropale.class.php index aeeaea757e8..d4f009aaccd 100644 --- a/htdocs/includes/modules/modPropale.class.php +++ b/htdocs/includes/modules/modPropale.class.php @@ -92,12 +92,11 @@ class modPropale "insert into llx_rights_def values (20,'Tous les droits sur les propositions commerciales','propale','a',0);", "insert into llx_rights_def values (21,'Lire les propositions commerciales','propale','r',1);", "insert into llx_rights_def values (22,'Créer modifier les propositions commerciales','propale','w',0);", - "insert into llx_rights_def values (23,'Modifier les propositions commerciales d\'autrui','propale','m',0);", - "insert into llx_rights_def values (24,'Valider les propositions commerciales','propale','d',0);" - "insert into llx_rights_def values (25,'Clôturer les propositions commerciales','propale','d',0);" + "insert into llx_rights_def values (24,'Valider les propositions commerciales','propale','d',0);", + "insert into llx_rights_def values (25,'Clôturer les propositions commerciales','propale','d',0);", "insert into llx_rights_def values (26,'Supprimer les propositions commerciales','propale','d',0);" ); - + //"insert into llx_rights_def values (23,'Modifier les propositions commerciales d\'autrui','propale','m',0);", for ($i = 0 ; $i < sizeof($sql) ; $i++) { $this->db->query($sql[$i]); diff --git a/htdocs/product/fiche.php3 b/htdocs/product/fiche.php3 index e5ad338a118..875a875b050 100644 --- a/htdocs/product/fiche.php3 +++ b/htdocs/product/fiche.php3 @@ -25,6 +25,8 @@ require("../propal.class.php3"); require("../facture.class.php3"); $user->getrights('produit'); +$user->getrights('propale'); +$user->getrights('facture'); $mesg = ''; if (!$user->rights->produit->lire) @@ -330,112 +332,124 @@ if ($id && $action == '' && $product->envente) $propal = New Propal($db); print ''; - - print ''; - print ''; - - print ''; - print '
'; - print_titre("Ajouter ma proposition"); - print ''; - print_titre("Ajouter aux autres propositions"); - print '
'; - $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price - p.remise as price, p.ref,".$db->pdate("p.datep")." as dp"; - $sql .= " FROM llx_societe as s, llx_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) ) + if($user->rights->propale->creer) { - $num = $db->num_rows(); - $i = 0; - print ''; - $var=True; - while ($i < $num) + print ''; + if($user->rights->propale->creer) { - $objp = $db->fetch_object( $i); - - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print ''; - print ''; - print '"; - print ''; - $i++; - } - print "
'; + print_titre("Ajouter ma proposition") . '
propalid\">$objp->refidp\">$objp->nom". strftime("%d %B %Y",$objp->dp)."
'; - print ''; - print ''; - print ''; - print "
"; - $db->free(); - } - - print '
'; - - $otherprop = $propal->liste_array(1, '<>'.$user->id); - if (sizeof($otherprop)) - { - print '
'; - print ''; - print ''; - print ""; - print '
Autres Propositions"; - $htmls->select_array("propalid", $otherprop); - print ''; - print ''; - print ''; - print ''; - print "
'; - } - print '
'; - print_titre("Ajouter ma facture"); - print ''; - print_titre("Ajouter aux autres factures"); - print '
'; - $sql = "SELECT s.nom, s.idp, f.rowid as factureid, f.facnumber,".$db->pdate("f.datef")." as df"; - $sql .= " FROM llx_societe as s, llx_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) + print ''; + } + print ''; + print '"; - print "\n"; - print "\n"; - print "\n"; - print ''; - print ''; - print '"; - print ''; - $i++; - } - print "
'; + print_titre("Ajouter aux autres propositions") . '
'; + $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price - p.remise as price, p.ref,".$db->pdate("p.datep")." as dp"; + $sql .= " FROM llx_societe as s, llx_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) ) { - $objp = $db->fetch_object( $i); - - $var=!$var; - print "
factureid\">$objp->facnumberidp\">$objp->nom". strftime("%d %B %Y",$objp->df)."
'; - print ''; - print ''; - print ''; - print "
"; - $db->free(); - } - else - { - print $db->error() . "
" . $sql; - } - print '
'; - print '
'; + $num = $db->num_rows(); + $i = 0; + print ''; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print ''; + print ''; + print '"; + print ''; + $i++; + } + print "
propalid\">$objp->refidp\">$objp->nom". strftime("%d %B %Y",$objp->dp)."
'; + print ''; + print ''; + print ''; + print "
"; + $db->free(); + } + print ''; + + if($user->rights->propale->creer) + { + print ''; + + $otherprop = $propal->liste_array(1, '<>'.$user->id); + if (sizeof($otherprop)) + { + print '
'; + print ''; + print ''; + print ""; + print '
Autres Propositions"; + $htmls->select_array("propalid", $otherprop); + print ''; + print ''; + print ''; + print ''; + print "
'; + } + print ''; + } + print ''; + } + + if($user->rights->facture->creer) + { + print ''; + print_titre("Ajouter ma facture"); + print ''; + print_titre("Ajouter aux autres factures"); + print ''; + print ''; + $sql = "SELECT s.nom, s.idp, f.rowid as factureid, f.facnumber,".$db->pdate("f.datef")." as df"; + $sql .= " FROM llx_societe as s, llx_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 "\n"; + print "\n"; + print "\n"; + print ''; + print ''; + print '"; + print ''; + $i++; + } + print "
factureid\">$objp->facnumberidp\">$objp->nom". strftime("%d %B %Y",$objp->df)."
'; + print ''; + print ''; + print ''; + print "
"; + $db->free(); + } + else + { + print $db->error() . "
" . $sql; + } + print ''; + print ''; + } }