diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 97d7cdae40f..fdfb84d9133 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -597,6 +597,8 @@ if ($_GET['propalid']) print ''.$langs->trans("Currency".$conf->monnaie).''; print ''.$langs->trans('AmountTTC').''.price($propal->total_ttc).''; print ''.$langs->trans("Currency".$conf->monnaie).''; + + // Statut print ''.$langs->trans('Status').''.$propal->getLibStatut().''; print '
'; if ($propal->brouillon == 1 && $user->rights->propale->creer) @@ -612,10 +614,10 @@ if ($_GET['propalid']) $sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid'; $sql .= ' WHERE pt.fk_propal = '.$propal->id; $sql .= ' ORDER BY pt.rowid ASC'; - $result = $db->query($sql); - if ($result) + $resql = $db->query($sql); + if ($resql) { - $num_lignes = $db->num_rows($result); + $num_lignes = $db->num_rows($resql); $i = 0; $total = 0; @@ -632,10 +634,10 @@ if ($_GET['propalid']) print '  '; print "\n"; } - $var=True; + $var=true; while ($i < $num_lignes) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($resql); $var=!$var; if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid) { @@ -722,14 +724,12 @@ if ($_GET['propalid']) print ' %'; print ''; print ''; - } - // $total = $total + ($objp->qty * $objp->price); $i++; } - $db->free($result); + $db->free($resql); } else { @@ -824,7 +824,7 @@ if ($_GET['propalid']) /* - * Barre d'actions + * Boutons Actions */ if ($propal->statut < 2) { @@ -972,10 +972,10 @@ if ($_GET['propalid']) $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql .= ' WHERE a.fk_soc = '.$obj->idp.' AND a.propalrowid = '.$propal->id ; - $result = $db->query($sql); - if ($result) + $resql = $db->query($sql); + if ($resql) { - $num = $db->num_rows($result); + $num = $db->num_rows($resql); if ($num) { print_titre($langs->trans('ActionsOnPropal')); @@ -989,7 +989,7 @@ if ($_GET['propalid']) while ($i < $num) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($resql); $var=!$var; print ''; print ''.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''; diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 26d137df289..26c111ce93e 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -181,35 +181,44 @@ if ($_GET["propalid"]) // Receiver $langs->load('mails'); print ''.$langs->trans('MailTo').''; - print ''; $dests=$societe->contact_array($societe->id); $numdest = count($dests); if ($numdest==0) { + print ''; print 'Cette societe n\'a pas de contact, veuillez en créer un avant de faire votre proposition commerciale
'; print ''.$langs->trans('AddContact').''; + print ''; } else { if ($propal->statut == 0 && $user->rights->propale->creer) { + print ''; print '
'; print ''; $form->select_contacts($societe->id, $propal->contactid, 'contactidp'); + print ''; print ''; print '
'; + print ''; } else { if (!empty($propal->contactid)) { + print ''; require_once(DOL_DOCUMENT_ROOT.'/contact.class.php'); $contact=new Contact($db); $contact->fetch($propal->contactid); print ''; print $contact->firstname.' '.$contact->name; print ''; + print ''; + } + else { + print ' '; } } } @@ -319,12 +328,12 @@ if ($_GET["propalid"]) if ($num_lignes) { print ''; - print ''.$langs->trans('Description').''; - print ''.$langs->trans('VAT').''; - print ''.$langs->trans('PriceUHT').''; - print ''.$langs->trans('Qty').''; - print ''.$langs->trans('Discount').''; - print ''.$langs->trans('AmountHT').''; + print ''.$langs->trans('Description').''; + print ''.$langs->trans('VAT').''; + print ''.$langs->trans('PriceUHT').''; + print ''.$langs->trans('Qty').''; + print ''.$langs->trans('Discount').''; + print ''.$langs->trans('AmountHT').''; print '  '; print "\n"; } @@ -343,7 +352,7 @@ if ($_GET["propalid"]) print img_object($langs->trans('ShowService'),'service'); else print img_object($langs->trans('ShowProduct'),'product'); - print ' '.stripslashes(nl2br($objp->description?$objp->description:$objp->product)).''; + print ' '.stripslashes(nl2br($objp->product)).''; if ($objp->date_start && $objp->date_end) { print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')'; @@ -356,6 +365,7 @@ if ($_GET["propalid"]) { print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')'; } + print $objp->description?'
'.$objp->description:''; print ''; } else @@ -392,8 +402,7 @@ if ($_GET["propalid"]) print ''; } - // Update ligne de facture - // \todo + $total = $total + ($objp->qty * $objp->price); @@ -605,10 +614,11 @@ if ($_GET["propalid"]) if (! $sortorder) $sortorder="DESC"; if ($page == -1) $page = 0 ; - $pageprev = $page - 1; - $pagenext = $page + 1; $limit = $conf->liste_limit; $offset = $limit * $page ; + $pageprev = $page - 1; + $pagenext = $page + 1; + $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.fk_statut, ".$db->pdate("p.datep")." as dp"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p ";