diff --git a/htdocs/comm/addpropal.php3 b/htdocs/comm/addpropal.php3 index e3d92feb428..058cd37b8da 100644 --- a/htdocs/comm/addpropal.php3 +++ b/htdocs/comm/addpropal.php3 @@ -46,178 +46,164 @@ print_titre("Nouvelle proposition commerciale"); */ if ($action == 'create') { - if ( $objsoc->prefix_comm ) + $numpr = propale_get_num(); + $sql = "SELECT count(*) FROM llx_propal WHERE ref like '$numpr%'"; + + if ( $db->query($sql) ) { - - $numpr = "PR-" . $objsoc->prefix_comm . "-" . strftime("%y%m%d", time()); - - $sql = "SELECT count(*) FROM llx_propal WHERE ref like '$numpr%'"; - - if ( $db->query($sql) ) + $num = $db->result(0, 0); + $db->free(); + if ($num > 0) { - $num = $db->result(0, 0); - $db->free(); - if ($num > 0) - { - $numpr .= "." . ($num + 1); - } + $numpr .= "." . ($num + 1); } + } - print "
"; - + } + $db->free(); } else { - print "Vous devez d'abord associer un prefixe commercial à cette société" ; + print $db->error(); } + + print_titre("Services/Produits"); + + print '| '; + print ' |