New: Gestion des aperus sur les propales (patch de Christophe)

This commit is contained in:
Laurent Destailleur 2005-08-13 15:11:49 +00:00
parent 5992673635
commit 161f61d6ff
8 changed files with 70 additions and 5 deletions

View File

@ -398,6 +398,10 @@ if ($_GET['propalid'])
$head[$h][1] = $langs->trans('AccountancyCard');
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans("Preview");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans('Note');
$h++;
@ -529,8 +533,8 @@ if ($_GET['propalid'])
if ($conf->projet->enabled)
{
$langs->load("projects");
print '<tr><td>'.$langs->trans('Project').'</td>';
$langs->load('projects');
$numprojet = $societe->has_projects();
if (! $numprojet)
{

View File

@ -105,6 +105,10 @@ if ($propalid > 0)
$head[$h][1] = $langs->trans('AccountancyCard');
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans("Preview");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans('Note');
$h++;

View File

@ -63,6 +63,10 @@ if ($_GET['propalid'])
$head[$h][1] = $langs->trans('AccountancyCard');
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans("Preview");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans('Note');
$h++;

View File

@ -83,6 +83,10 @@ if ($_GET['propalid'])
$head[$h][1] = $langs->trans('AccountancyCard');
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans("Preview");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans('Note');
$hselected=$h;

View File

@ -107,6 +107,10 @@ if ($_GET["propalid"])
$hselected=$h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans("Preview");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans('Note');
$h++;
@ -221,9 +225,9 @@ if ($_GET["propalid"])
$langs->load("projects");
print '<tr><td>'.$langs->trans('Project').'</td>';
$numprojet = $societe->has_projects();
print '<td colspan="2">';
if (! $numprojet)
{
print '<td colspan="2">';
print $langs->trans("NoProject").'</td><td>';
print '<a href=../projet/fiche.php?socidp='.$societe->id.'&action=create>'.$langs->trans('AddProject').'</a>';
print '</td>';
@ -232,10 +236,11 @@ if ($_GET["propalid"])
{
if ($propal->statut == 0 && $user->rights->propale->creer)
{
print '<td colspan="3">';
print '<td colspan="2">';
print '<form action="propal.php?propalid='.$propal->id.'" method="post">';
print '<input type="hidden" name="action" value="set_project">';
$form->select_projects($societe->id, $propal->projetidp, 'projetidp');
print '</td><td>';
print '<input type="submit" value="'.$langs->trans('Modify').'">';
print '</form>';
print '</td>';
@ -265,7 +270,8 @@ if ($_GET["propalid"])
{
print '<form action="propal.php?propalid='.$propal->id.'" method="post">';
print '<input type="hidden" name="action" value="setremise">';
print '<td colspan="3"><input type="text" name="remise" size="3" value="'.$propal->remise_percent.'">% ';
print '<td colspan="2"><input type="text" name="remise" size="3" value="'.$propal->remise_percent.'">% ';
print '</td><td>';
print '<input type="submit" value="'.$langs->trans('Modify').'">';
print ' <a href="propal/aideremise.php?propalid='.$propal->id.'">?</a>';
print '</td>';

View File

@ -127,6 +127,8 @@ function propale_pdf_create($db, $facid, $modele='')
if ( $obj->write_pdf_file($facid) > 0)
{
// on supprime l'image correspondant au preview
propale_delete_preview($db, $facid);
return 1;
}
else
@ -142,4 +144,33 @@ function propale_pdf_create($db, $facid, $modele='')
return 0;
}
}
/**
\brief Supprime l'image de prévisualitation, pour le cas de régénération de propal
\param db objet base de donnée
\param propalid id de la propal à effacer
*/
function propale_delete_preview($db, $propalid)
{
global $langs,$conf;
$propal = new Propal($db,"",$propalid);
$propal->fetch($propalid);
$propal->fetch_client();
if ($conf->propal->dir_output)
{
$propalref = sanitize_string($propal->ref);
$dir = $conf->propal->dir_output . "/" . $propalref ;
$file = $dir . "/" . $propalref . ".pdf.png";
if ( file_exists( $file ) && is_writable( $file ) )
{
if ( ! unlink($file) )
{
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
return 0;
}
}
}
}
?>

View File

@ -57,4 +57,5 @@ CloseAs=Cl
ClassifyBilled=Classer facturée
BuildBill=Créer facture
RelatedBill=Facture associée
RelatedBills=Factures associées
RelatedBills=Factures associées
ErrorPropalNotFound=Propal %s inexistante

View File

@ -70,6 +70,17 @@ if ($modulepart)
$original_file=$conf->facture->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu propal
if ($modulepart == 'apercupropal')
{
$user->getrights('propale');
if ($user->rights->propale->lire)
{
$accessallowed=1;
}
$original_file=$conf->propal->dir_output.'/'.$original_file;
}
// Wrapping pour les images des stats propales
if ($modulepart == 'propalstats')
{