| '.$langs->trans('Ref').' | '; -print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); -print ' | |||||||
';
-print '
| '; -if ($user->rights->propal->creer && $action == 'refclient') -{ - print ''; -} -else -{ - print $object->ref_client; -} -print ' | '; -print '|||||||
| '.$langs->trans('Company').' | '.$soc->getNomUrl(1).' | '; -print '|||||||
| '.$langs->trans('Discounts').' | ';
-if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
-else print $langs->trans("CompanyHasNoRelativeDiscount");
-print '. ';
-$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
-$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
-$absolute_discount=price2num($absolute_discount,'MT');
-$absolute_creditnote=price2num($absolute_creditnote,'MT');
-if ($absolute_discount)
-{
- if ($object->statut > 0)
- {
- print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
- }
- else
- {
- // Remise dispo de type non avoir
- $filter='fk_facture_source IS NULL';
- print ' '; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter); - } -} -if ($absolute_creditnote) -{ - print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; -} -if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; -print ' | |||||||
';
-print '
| '; -if (! empty($object->brouillon) && $action == 'editdate') -{ - print ''; -} -else -{ - if ($object->date) - { - print dol_print_date($object->date,'daytext'); - } - else - { - print ' '; - } -} -print ' | '; - -// Date end proposal -print '|||||||
';
-print '
| '; -if (! empty($object->brouillon) && $action == 'editecheance') -{ - print ''; -} -else -{ - if (! empty($object->fin_validite)) - { - print dol_print_date($object->fin_validite,'daytext'); - if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); - } - else - { - print ' '; - } -} -print ' | '; -print '|||||||
';
-print '
| '; -if ($action == 'editconditions') -{ - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); -} -else -{ - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); -} -print ' | '; -print '|||||||
';
-print '
| '; -if ($action == 'editdate_livraison') -{ - print ''; -} -else -{ - print dol_print_date($object->date_livraison,'daytext'); -} -print ' | '; -print '|||||||
';
-print '
| '; -if ($action == 'editavailability') -{ - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'availability_id',1); -} -else -{ - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); -} - -print ' | '; -print '|||||||
';
-print '
| '; -//print $object->demand_reason_id; -if ($action == 'editdemandreason') -{ - $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); -} -else -{ - $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); -} - -print ' | '; -print '|||||||
';
-print '
| '; -if ($action == 'editmode') -{ - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); -} -else -{ - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); -} -print ' | |||||||
';
- print '
| '; - if ($action == 'classify') + $obj=$db->fetch_object($resql); + $num = $obj->nb; + $db->free($resql); + if ($num > 0) { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid'); + $numpr .= "." . ($num + 1); + } + } + + print '"; +} +else +{ + /* + * Show object in view mode + */ + + $soc = new Societe($db); + $soc->fetch($object->socid); + + $head = propal_prepare_head($object); + dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); + + $formconfirm=''; + + // Clone confirmation + if ($action == 'clone') { - print ' | |||||||
| '.$langs->trans('Ref').' | '; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + print ' | |||||||
';
+ print '
| '; + if ($user->rights->propal->creer && $action == 'refclient') + { + print ''; + } + else + { + print $object->ref_client; + } + print ' | '; + print '|||||||
| '.$langs->trans('Company').' | '.$soc->getNomUrl(1).' | '; + print '|||||||
| '.$langs->trans('Discounts').' | ';
+ if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
+ else print $langs->trans("CompanyHasNoRelativeDiscount");
+ print '. ';
+ $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
+ $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
+ $absolute_discount=price2num($absolute_discount,'MT');
+ $absolute_creditnote=price2num($absolute_creditnote,'MT');
+ if ($absolute_discount)
+ {
+ if ($object->statut > 0)
{
- if (count($object->lines) > 0) print 'id.'&action=validate">'.$langs->trans('Validate').'';
- else print ''.$langs->trans('Validate').'';
+ print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
}
-
- // Edit
- if ($object->statut == 1 && $user->rights->propal->creer)
+ else
{
- print 'id.'&action=modif">'.$langs->trans('Modify').'';
+ // Remise dispo de type non avoir
+ $filter='fk_facture_source IS NULL';
+ print ' '; + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter); } - - // ReOpen - if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) + } + if ($absolute_creditnote) + { + print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; + } + if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; + print ' | |||||||
';
+ print '
| '; + if (! empty($object->brouillon) && $action == 'editdate') + { + print ''; + } + else + { + if ($object->date) { - print 'id.'&action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"'; - print '>'.$langs->trans('ReOpen').''; + print dol_print_date($object->date,'daytext'); } - - // Send - if ($object->statut == 1 || $object->statut == 2) + else { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) - { - print 'id.'&action=presend&mode=init">'.$langs->trans('SendByMail').''; - } - else print ''.$langs->trans('SendByMail').''; + print ' '; } - - // Create an order - if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) - { - if ($user->rights->commande->creer) - { - print ''.$langs->trans("AddOrder").''; - } - } - - // Create an invoice and classify billed - if ($object->statut == 2 && $user->societe_id == 0) + } + print ' | '; + + // Date end proposal + print '|||||||
';
+ print '
| '; + if (! empty($object->brouillon) && $action == 'editecheance') + { + print ''; + } + else + { + if (! empty($object->fin_validite)) { - if (! empty($conf->facture->enabled) && $user->rights->facture->creer) - { - print ''.$langs->trans("AddBill").''; - } - - $arraypropal=$object->getInvoiceArrayList(); - if (is_array($arraypropal) && count($arraypropal) > 0) - { - print 'id.'&action=classifybilled&socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").''; - } + print dol_print_date($object->fin_validite,'daytext'); + if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); } - - // Close - if ($object->statut == 1 && $user->rights->propal->cloturer) + else { - print 'id.'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#close').'"'; - print '>'.$langs->trans('Close').''; + print ' '; } - - // Clone + } + print ' | '; + print '|||||||
';
+ print '
| '; + if ($action == 'editconditions') + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); + } + else + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); + } + print ' | '; + print '|||||||
';
+ print '
| '; + if ($action == 'editdate_livraison') + { + print ''; + } + else + { + print dol_print_date($object->date_livraison,'daytext'); + } + print ' | '; + print '|||||||
';
+ print '
| '; + if ($action == 'editavailability') + { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'availability_id',1); + } + else + { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); + } + + print ' | '; + print '|||||||
';
+ print '
| '; + //print $object->demand_reason_id; + if ($action == 'editdemandreason') + { + $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); + } + else + { + $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); + } + + print ' | '; + print '|||||||
';
+ print '
| '; + if ($action == 'editmode') + { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); + } + else + { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); + } + print ' | |||||||
';
+ print '
| '; + if ($action == 'classify') + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid'); + } + else + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none'); + } + print ' | |||||||