diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 650bbdb4b19..1888ecb52cc 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -80,6 +80,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') $brouillon = 1; } Header('Location: propal.php'); + exit; } if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes') @@ -88,17 +89,26 @@ if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes') { $propal = new Propal($db); $propal->fetch($_GET['propalid']); - $propal->update_price($_GET['propalid']); + $result=$propal->update_price($_GET['propalid']); propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf); - $propal->valid($user); + $result=$propal->valid($user); } Header ('Location: propal.php?propalid='.$_GET['propalid']); + exit; +} + +if ($_POST['action'] == 'setecheance') +{ + $propal = new Propal($db); + $propal->fetch($_GET['propalid']); + $result=$propal->set_echeance($user,mktime(12, 1, 1, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); + if ($result < 0) dolibarr_print_error($db,$propal->error); } if ($_POST['action'] == 'add') { $propal = new Propal($db, $_GET['socidp']); - $propal->datep = mktime(12, 1 , 1, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $propal->datep = mktime(12, 1, 1, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $propal->duree_validite = $_POST['duree_validite']; @@ -138,24 +148,23 @@ if ($_POST['action'] == 'add') if ($_GET['action'] == 'pdf') { - $propal = new Propal($db); - $propal->fetch($_GET['propalid']); - propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf); + $propal = new Propal($db); + $propal->fetch($_GET['propalid']); + propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf); } +/* + * Cloture de la propale + */ if ($_POST['action'] == 'setstatut' && $user->rights->propale->cloturer) { - /* - * Cloture de la propale - */ - $propal = new Propal($db); - $propal->fetch($_GET['propalid']); - $propal->cloture($user, $_POST['statut'], $_POST['note']); + $propal = new Propal($db); + $propal->fetch($_GET['propalid']); + $propal->cloture($user, $_POST['statut'], $_POST['note']); } /* * Envoi de la propale par mail - * */ if ($_POST['action'] == 'send') { @@ -362,6 +371,7 @@ if ($_POST['action'] == 'set_contact') llxHeader(); +$html = new Form($db); /* * Affichage fiche propal en mode visu @@ -370,7 +380,6 @@ llxHeader(); if ($_GET['propalid'] > 0) { if ($msg) print "$msg
"; - $html = new Form($db); $propal = new Propal($db); $propal->fetch($_GET['propalid']); @@ -450,7 +459,9 @@ if ($_GET['propalid'] > 0) print ''; $rowspan=6; - print ''; - print ''; - print ''; print ''; + // Dates print ''; - print ''; print ''; + // Conditions et modes de réglement + print ''; + print ''; + // Destinataire $langs->load('mails'); print ''; @@ -502,7 +563,7 @@ if ($_GET['propalid'] > 0) print ''; - print '\n"; - - if ($objp->client == 1) - { - $url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp; - } - else - { - $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objp->idp; - } - print ''; - - // Date propale - print '\n"; - - // Date fin validite - if ( $now > $objp->dfv && $objp->dfv > 0 ) - { - print ''; - } - else - { - print ''; - } - - print '\n"; - $propal=New Propal($db); - print '\n"; - print "\n"; - - $total = $total + $objp->price; - $subtotal = $subtotal + $objp->price; - - $i++; - } + { + $objp = $db->fetch_object($result); + $now = time(); + $var=!$var; + print ''; + print '\n"; + + if ($objp->client == 1) + { + $url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp; + } + else + { + $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objp->idp; + } + print ''; + + // Date propale + print '\n"; + + // Date fin validite + if ($objp->dfv) + { + print ''; + } + else + { + print ''; + } + + print '\n"; + $propal=New Propal($db); + print '\n"; + print "\n"; + + $total = $total + $objp->price; + $subtotal = $subtotal + $objp->price; + + $i++; + } print '
'.$langs->trans('Company').''; + + // Société + print '
'.$langs->trans('Company').''; if ($societe->client == 1) { $url ='fiche.php?socid='.$societe->id; @@ -460,27 +471,77 @@ if ($_GET['propalid'] > 0) $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id; } print ''.$societe->nom.'Conditions de réglement'.' '.'
'.$langs->trans('Date').''; print dolibarr_print_date($propal->date,'%a %d %B %Y'); print ''.$langs->trans('DateEndPropal').''; - if ($propal->fin_validite) + print ''; + print ''; + if ($_GET['action'] != 'editecheance' && $propal->brouillon) print ''; + print '
'; + print $langs->trans('DateEndPropal'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print '
'; + if ($propal->brouillon && $_GET['action'] == 'editecheance') { - 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")); + print '
'; + print ''; + $html->select_date($propal->fin_validite,'ech'); + print ''; + print '
'; } else { - print $langs->trans("Unknown"); + 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 ''; +// if ($_GET['action'] != 'editconditions' && $propal->brouillon) print ''; + print '
'; + print $langs->trans('PaymentConditions'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print '
'; + if ($_GET['action'] == 'editconditions') + { + $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->cond_reglement_id,'cond_reglement_id'); + } + else + { + $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->cond_reglement_id,'none'); + } + print ''; + print ''; +// if ($_GET['action'] != 'editmode' && $propal->brouillon) print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; + print '
'; + if ($_GET['action'] == 'editmode') + { + $html->form_modes_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->mode_reglement_id,'mode_reglement_id'); + } + else + { + $html->form_modes_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->mode_reglement_id,'none'); + } + print '
'; print '
'; print ''; - $form->select_contacts($societe->id, $propal->contactid, 'contactidp'); + $html->select_contacts($societe->id, $propal->contactid, 'contactidp'); print '
'; print ''; print ''; @@ -513,7 +574,7 @@ if ($_GET['propalid'] > 0) if (!empty($propal->contactid)) { print ''; - include_once(DOL_DOCUMENT_ROOT."/contact.class.php"); + require_once(DOL_DOCUMENT_ROOT.'/contact.class.php'); $contact=new Contact($db); $contact->fetch($propal->contactid); print ''; @@ -952,7 +1013,7 @@ if ($_GET['propalid'] > 0) $var=true; - $form->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); + $html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); /* @@ -1168,56 +1229,56 @@ else $var=true; while ($i < min($num,$limit)) - { - $objp = $db->fetch_object($result); - $now = time(); - $var=!$var; - print '
'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref."'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.''; - $y = strftime('%Y',$objp->dp); - $m = strftime('%m',$objp->dp); - - print strftime('%d',$objp->dp)."\n"; - print ' '; - print dolibarr_print_date($objp->dp,'%b')."\n"; - print ' '; - print strftime('%Y',$objp->dp)."'.dolibarr_print_date($objp->dfv); - if ($objp->fk_statut == 1 && $objp->dfv < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); - print ' '.price($objp->price)."'.$propal->LibStatut($objp->fk_statut,0)."
'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref."'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.''; + $y = strftime('%Y',$objp->dp); + $m = strftime('%m',$objp->dp); + + print strftime('%d',$objp->dp)."\n"; + print ' '; + print dolibarr_print_date($objp->dp,'%b')."\n"; + print ' '; + print strftime('%Y',$objp->dp)."'.dolibarr_print_date($objp->dfv); + if ($objp->fk_statut == 1 && $objp->dfv < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + print ' '.price($objp->price)."'.$propal->LibStatut($objp->fk_statut,0)."
'; $db->free($result); } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2d4d4c51a08..194b23ce589 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1154,7 +1154,7 @@ else if ($_GET['action'] == 'valid') { $numfa = facture_get_num($soc); - $html->form_confirm('facture.php?facid='.$fac->id,$langs->trans('ValidateBill'),$langs->trans('ConfirmValidateBill',$numfa),'confirm_valid'); + $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$langs->trans('ConfirmValidateBill',$numfa),'confirm_valid'); print '
'; } @@ -1163,7 +1163,7 @@ else */ if ($_GET['action'] == 'payed') { - $html->form_confirm('facture.php?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed'); + $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed'); print '
'; } @@ -1180,10 +1180,14 @@ else * Facture */ print ''; + + // Société print ''; print ''; + print ''; + // Dates print ''; print ''; print '
'.$langs->trans('Company').''; print ''.$soc->nom.'
'.$langs->trans('Date').''.dolibarr_print_date($fac->date,'%A %d %B %Y').''.$langs->trans('DateClosing').'' . dolibarr_print_date($fac->date_lim_reglement,'%A %d %B %Y'); @@ -1195,7 +1199,7 @@ else print ''; - if ($_GET['action'] != 'editconditions' && $fac->brouillon) print ''; + if ($_GET['action'] != 'editconditions' && $fac->brouillon) print ''; print '
'; print $langs->trans('PaymentConditions'); print ''.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print '
'; if ($_GET['action'] == 'editconditions') @@ -1211,7 +1215,7 @@ else print ''; - if ($_GET['action'] != 'editmode' && $fac->brouillon) print ''; + if ($_GET['action'] != 'editmode' && $fac->brouillon) print ''; print '
'; print $langs->trans('PaymentMode'); print ''.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print '
'; if ($_GET['action'] == 'editmode') diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 887ff85de05..9d8c36407d6 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -87,15 +87,17 @@ if ( $action == 'delete' ) llxHeader(); -$form = new Form($db); +$html = new Form($db); /* * * Mode fiche * */ -if ($_GET["propalid"]) +if ($_GET["propalid"] > 0) { + if ($msg) print "$msg
"; + $propal = new Propal($db); $propal->fetch($_GET["propalid"]); $h=0; @@ -153,7 +155,9 @@ if ($_GET["propalid"]) print ''; $rowspan=6; - print ''; - print ''; - print ''; print ''; + // Dates print ''; @@ -184,6 +187,40 @@ if ($_GET["propalid"]) print ''; print ''; + // Conditions et modes de réglement + print ''; + print ''; + // Destinataire $langs->load('mails'); print ''; @@ -205,7 +242,7 @@ if ($_GET["propalid"]) print '
'.$langs->trans('Company').''; + + // Société + print '
'.$langs->trans('Company').''; if ($societe->client == 1) { $url ='fiche.php?socid='.$societe->id; @@ -163,10 +167,9 @@ if ($_GET["propalid"]) $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id; } print ''.$societe->nom.'Conditions de réglement'.' '.'
'.$langs->trans('Date').''; print dolibarr_print_date($propal->date,'%a %d %B %Y'); print '
'; + print ''; + if ($_GET['action'] != 'editconditions' && $prop->brouillon) print ''; + print '
'; + print $langs->trans('PaymentConditions'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print '
'; + if ($_GET['action'] == 'editconditions') + { + $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$prop->id,$prop->cond_reglement_id,'cond_reglement_id'); + } + else + { + $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$prop->id,$prop->cond_reglement_id,'none'); + } + print ''; + print ''; + if ($_GET['action'] != 'editmode' && $prop->brouillon) print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; + print '
'; + if ($_GET['action'] == 'editmode') + { + $html->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$prop->id,$prop->mode_reglement_id,'mode_reglement_id'); + } + else + { + $html->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$prop->id,$prop->mode_reglement_id,'none'); + } + print '
'; print '
'; print ''; - $form->select_contacts($societe->id, $propal->contactid, 'contactidp'); + $html->select_contacts($societe->id, $propal->contactid, 'contactidp'); print '
'; print ''; print ''; @@ -469,7 +506,7 @@ if ($_GET["propalid"]) $var=true; - $form->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed); + $html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed); /*