diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index ee35efdd596..cd9c65ae9cd 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -46,18 +46,19 @@ require_once('../propal.class.php'); require_once('../actioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); +if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); } +$year=isset($_GET["year"])?$_GET["year"]:""; +$month=isset($_GET["month"])?$_GET["month"]:""; + // Sécurité accés client +$socidp=''; +if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } if ($user->societe_id > 0) { $action = ''; $socidp = $user->societe_id; } -if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } -if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); } -$year=isset($_GET["year"])?$_GET["year"]:""; -$month=isset($_GET["month"])?$_GET["month"]:""; - // Nombre de ligne pour choix de produit/service prédéfinis $NBLINES=4; @@ -420,369 +421,369 @@ if ($_GET['propalid'] > 0) $resql = $db->query($sql); if ($resql) { - if ($db->num_rows($resql)) - { - $obj = $db->fetch_object($resql); - - $societe = new Societe($db); - $societe->fetch($obj->idp); - - print '
| '.$langs->trans('Company').' | '; - if ($societe->client == 1) - { - $url ='fiche.php?socid='.$societe->id; - } - else - { - $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id; - } - print ''.$societe->nom.' | '; - print 'Conditions de réglement | '; - print ''.' '.' | '; - print '|||||||||||
| '.$langs->trans('Date').' | '; - print dolibarr_print_date($propal->date,'%a %d %B %Y'); - print ' | '; - - print ''.$langs->trans('DateEndPropal').' | '; - if ($propal->fin_validite) - { - print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y'); - if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); - } - else - { - print $langs->trans("Unknown"); - } - print ' | '; - print '|||||||||||
| '.$langs->trans('MailTo').' | '; - - $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 ''; - 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 ''; - } - } - } - print ''; - - if ($conf->projet->enabled) - $rowspan++; - - print ' | '.$langs->trans('Note').' : '. nl2br($propal->note).' | ||||||||
| '.$langs->trans('Project').' | '; - $numprojet = $societe->has_projects(); - if (! $numprojet) - { - print ''; - print $langs->trans("NoProject").' | '; - print 'id.'&action=create>'.$langs->trans('AddProject').''; - print ' | '; - } - else - { - if ($propal->statut == 0 && $user->rights->propale->creer) - { - print ''; - print ' | '; - print ''; - print ''; - print ' | '; - } - else - { - if (!empty($propal->projetidp)) - { - print ''; - $proj = new Project($db); - $proj->fetch($propal->projetidp); - print ''; - print $proj->title; - print ''; - print ' | '; - } - else { - print ''; - } - } - } - print ' | ||||||||
| '.$langs->trans('GlobalDiscount').' | '; - if ($propal->brouillon == 1 && $user->rights->propale->creer) - { - print ''; - } - else - { - print ''.$propal->remise_percent.'% | '; - } - print '|||||||||||||
| '.$langs->trans('AmountHT').' | '; - print ''.price($propal->price).' | '; - print ''.$langs->trans("Currency".$conf->monnaie).' | ||||||||||||
| '.$langs->trans('VAT').' | '.price($propal->total_tva).' | '; - print ''.$langs->trans("Currency".$conf->monnaie).' | ||||||||||||
| '.$langs->trans('AmountTTC').' | '.price($propal->total_ttc).' | '; - print ''.$langs->trans("Currency".$conf->monnaie).' | ||||||||||||
| '.$langs->trans('Status').' | '.$propal->getLibStatut().' | |||||||||||||
| '.$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 " | ||||||||||||||||||||||||||||||||||||||||
| ';
- if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
- else print img_object($langs->trans('ShowProduct'),'product');
- print ' '.$objp->ref.' - '.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).')';
- }
- if ($objp->date_start && ! $objp->date_end)
- {
- print ' (A partir du '.dolibarr_print_date($objp->date_start).')';
- }
- if (! $objp->date_start && $objp->date_end)
- {
- print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
- }
- print ($objp->description && $objp->description!=$obj->product)?' '.$objp->description:''; + if($db->num_rows($resql)) + { + $obj = $db->fetch_object($resql); + + $societe = new Societe($db); + $societe->fetch($obj->idp); + + print '
| '; + 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 ''; + } + } + } + print ''; + + if ($conf->projet->enabled) + $rowspan++; + + print ' | '.$langs->trans('Note').' : '. nl2br($propal->note).' | |||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans('Project').' | '; + $numprojet = $societe->has_projects(); + if (! $numprojet) + { + print ''; + print $langs->trans("NoProject").' | '; + print 'id.'&action=create>'.$langs->trans('AddProject').''; + print ' | '; + } + else + { + if ($propal->statut == 0 && $user->rights->propale->creer) + { + print ''; + print ' | '; + print ''; + print ''; + print ' | '; + } + else + { + if (!empty($propal->projetidp)) + { + print ''; + $proj = new Project($db); + $proj->fetch($propal->projetidp); + print ''; + print $proj->title; + print ''; + print ' | '; + } + else { + print ''; + } + } + } + print ' | ||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans('GlobalDiscount').' | '; + if ($propal->brouillon == 1 && $user->rights->propale->creer) + { + print ''; + } + else + { + print ''.$propal->remise_percent.'% | '; + } + print '|||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans('AmountHT').' | '; + print ''.price($propal->price).' | '; + print ''.$langs->trans("Currency".$conf->monnaie).' | ||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans('VAT').' | '.price($propal->total_tva).' | '; + print ''.$langs->trans("Currency".$conf->monnaie).' | ||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans('AmountTTC').' | '.price($propal->total_ttc).' | '; + print ''.$langs->trans("Currency".$conf->monnaie).' | ||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans('Status').' | '.$propal->getLibStatut().' | |||||||||||||||||||||||||||||||||||||||||||||
| '.$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 " | |||||
| ';
+ if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
+ else print img_object($langs->trans('ShowProduct'),'product');
+ print ' '.$objp->ref.' - '.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).')';
+ }
+ if ($objp->date_start && ! $objp->date_end)
+ {
+ print ' (A partir du '.dolibarr_print_date($objp->date_start).')';
+ }
+ if (! $objp->date_start && $objp->date_end)
+ {
+ print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
+ }
+ print ($objp->description && $objp->description!=$obj->product)?' '.$objp->description:''; + print ' | ';
+ }
+ else
+ {
+ print ''.stripslashes(nl2br($objp->description)); + if ($objp->date_start && $objp->date_end) + { + print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')'; + } + if ($objp->date_start && ! $objp->date_end) + { + print ' (A partir du '.dolibarr_print_date($objp->date_start).')'; + } + if (! $objp->date_start && $objp->date_end) + { + print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')'; + } + print " | \n"; + } + print ''.$objp->tva_tx.'% | '; + print ''.price($objp->subprice)." | \n"; + print ''.$objp->qty.' | '; + if ($objp->remise_percent > 0) + { + print ''.$objp->remise_percent."% | \n"; + } + else + { + print ''; + } + print ' | '.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)." | \n"; + + // Icone d'edition et suppression + if ($propal->statut == 0 && $user->rights->propale->creer) + { + print ''; + print img_edit(); + print ' | '; + print ''; + print img_delete(); + print ' | '; + } + else + { + print ''; + } + print ' | |
| '.$langs->trans('Description').' | '; + print ''.$langs->trans('VAT').' | '; + print ''.$langs->trans('PriceUHT').' | '; + print ''.$langs->trans('Qty').' | '; + print ''.$langs->trans('Discount').' | '; + print ''; + print ' | '; + print ' | '; + print " |