L'onglet 'Documents' des propales est fonctionnel + diverses modifications esthtiques
This commit is contained in:
parent
cea58d9122
commit
a16e2ef285
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,140 +21,167 @@
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/** \file htdocs/comm/propal/document.php
|
||||
\ingroup propale
|
||||
\brief Page de gestion des documents attachées à une proposition commerciale
|
||||
\version $Revision$
|
||||
/**
|
||||
\file htdocs/comm/propal/document.php
|
||||
\ingroup propale
|
||||
\brief Page de gestion des documents attachées à une proposition commerciale
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once("../../propal.class.php");
|
||||
require('./pre.inc.php');
|
||||
require_once('../../propal.class.php');
|
||||
|
||||
$user->getrights('propale');
|
||||
|
||||
if (!$user->rights->propale->lire)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$propalid=empty($_GET['propalid']) ? 0 : intVal($_GET['propalid']);
|
||||
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action'];
|
||||
|
||||
function do_upload ($upload_dir)
|
||||
{
|
||||
global $local_file, $error_msg;
|
||||
global $local_file, $error_msg, $langs;
|
||||
|
||||
if (! is_dir($upload_dir))
|
||||
{
|
||||
umask(0);
|
||||
mkdir($upload_dir, 0755);
|
||||
}
|
||||
|
||||
if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']))
|
||||
{
|
||||
print "Le fichier est valide, et a été téléchargé avec succès.\n";
|
||||
//print_r($_FILES);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Le fichier n'a pas été téléchargé";
|
||||
// print_r($_FILES);
|
||||
}
|
||||
if (! is_dir($upload_dir))
|
||||
{
|
||||
umask(0);
|
||||
mkdir($upload_dir, 0755);
|
||||
}
|
||||
|
||||
if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . '/' . $_FILES['userfile']['name']))
|
||||
{
|
||||
echo $langs->trans('FileUploaded');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $langs->trans('FileNotUploaded');
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
if ($_GET["id"] > 0)
|
||||
if ($propalid > 0)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
|
||||
if ($propal->fetch($_GET["id"]))
|
||||
$propal = new Propal($db);
|
||||
|
||||
if ($propal->fetch($propalid))
|
||||
{
|
||||
|
||||
$upload_dir = $conf->propal->dir_output . "/" . $propal->ref ;
|
||||
|
||||
if ( $error_msg )
|
||||
{
|
||||
echo "<B>$error_msg</B><BR><BR>";
|
||||
}
|
||||
|
||||
if ($action=='delete')
|
||||
{
|
||||
$file = $upload_dir . "/" . urldecode($urlfile);
|
||||
dol_delete_file($file);
|
||||
}
|
||||
|
||||
if ( $_POST["sendit"] )
|
||||
{
|
||||
do_upload ($upload_dir);
|
||||
}
|
||||
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
print "<tr><td><div class=\"titre\">Documents associés à la proposition : ".$propal->ref_url."</div></td>";
|
||||
print "</tr></table>";
|
||||
|
||||
print '<form name="userfile" action="document.php?id='.$propal->id.'" enctype="multipart/form-data" method="POST">';
|
||||
print '<input type="hidden" name="max_file_size" value="2000000">';
|
||||
print '<input type="file" name="userfile" size="40" maxlength="80"><br>';
|
||||
print '<input type="submit" value="'.$langs->trans("Upload").'" name="sendit">';
|
||||
print '<input type="submit" value="'.$langs->trans("Cancel").'" name="cancelit"><br>';
|
||||
print '</form><br>';
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$handle=opendir($upload_dir);
|
||||
|
||||
if ($handle)
|
||||
{
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
{
|
||||
print '<tr><td>';
|
||||
echo '<a target="_blank" href="'.DOL_URL_ROOT.'/document.php?modulepart=propal&file='.urlencode($propal->ref.'/'.$file).'">'.$file.'</a>';
|
||||
print "</td>\n";
|
||||
|
||||
print '<td align="right">'.filesize($upload_dir."/".$file). ' bytes</td>';
|
||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($upload_dir."/".$file)).'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
if ($file == $propal->ref . '.pdf')
|
||||
{
|
||||
echo '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$propal->id.'&action=delete&urlfile='.urlencode($file).'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
$forbidden_chars=array('/','\\',':','*','?','"','<','>','|','[',']',',',';','=');
|
||||
$propref = str_replace($forbidden_chars, '_', $propal->ref);
|
||||
$upload_dir = $conf->propal->dir_output.'/'.$propref;
|
||||
if ( $error_msg )
|
||||
{
|
||||
echo '<B>'.$error_msg.'</B><BR><BR>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
if ($action=='delete')
|
||||
{
|
||||
$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
|
||||
dol_delete_file($file);
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
if ( $_POST['sendit'] )
|
||||
{
|
||||
do_upload ($upload_dir);
|
||||
}
|
||||
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Card');
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Note');
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Info');
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans('Proposal').': '.$propal->ref);
|
||||
|
||||
print_titre($langs->trans('AssociatedDocuments').' '.$propal->ref_url);
|
||||
|
||||
print '<form name="userfile" action="document.php?propalid='.$propal->id.'" enctype="multipart/form-data" method="POST">';
|
||||
print '<input type="hidden" name="max_file_size" value="2000000">';
|
||||
print '<input type="file" name="userfile" size="40" maxlength="80"><br>';
|
||||
print '<input type="submit" value="'.$langs->trans('Upload').'" name="sendit">';
|
||||
print '<input type="submit" value="'.$langs->trans('Cancel').'" name="cancelit"><br>';
|
||||
print '</form><br>';
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$handle=opendir($upload_dir);
|
||||
|
||||
if ($handle)
|
||||
{
|
||||
print '<table width="100%" class="border">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Document').'</td>';
|
||||
print '<td>'.$langs->trans('Size').'</td>';
|
||||
print '<td>'.$langs->trans('Date').'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
echo '<a target="_blank" href="'.DOL_URL_ROOT.'/document.php?modulepart=propal&file='.$propref.'/'.urlencode($file).'">'.$file.'</a>';
|
||||
print "</td>\n";
|
||||
print '<td align="right">'.filesize($upload_dir.'/'.$file). ' bytes</td>';
|
||||
print '<td align="right">'.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).'</td>';
|
||||
print '<td align="center">';
|
||||
if ($file == $propref . '.pdf')
|
||||
{
|
||||
echo '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id.'&action=delete&urlfile='.urlencode($file).'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
closedir($handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<p>'.$langs->trans('ErrorCantOpenDir').'<b> '.$upload_dir.'</b>';
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print "<p>Impossible d'ouvrir : <b>".$upload_dir."</b>";
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
print 'Erreur';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('<em>Dernière modification $Date$ révision $Revision$</em>');
|
||||
?>
|
||||
|
||||
@ -27,55 +27,59 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require('./pre.inc.php');
|
||||
|
||||
$langs->load("propal");
|
||||
$langs->load('propal');
|
||||
|
||||
$user->getrights('propale');
|
||||
if (!$user->rights->propale->lire)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
require("../../propal.class.php");
|
||||
require('../../propal.class.php');
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
llxHeader();
|
||||
|
||||
if ($_GET["propalid"])
|
||||
if ($_GET['propalid'])
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["propalid"]);
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($propal->soc_id);
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$h++;
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($propal->soc_id);
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Proposal").": $propal->ref");
|
||||
|
||||
$propal->info($propal->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Card');
|
||||
$h++;
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dolibarr_print_object_info($propal);
|
||||
print '</td></tr></table>';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Note');
|
||||
$h++;
|
||||
|
||||
print "<br></div>";
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Info');
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans('Proposal').': '.$propal->ref);
|
||||
|
||||
$propal->info($propal->id);
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dolibarr_print_object_info($propal);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '<br></div>';
|
||||
|
||||
$db->close();
|
||||
$db->close();
|
||||
}
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('<em>Dernière modification $Date$ révision $Revision$</em>');
|
||||
?>
|
||||
|
||||
@ -23,20 +23,20 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/propal/note.php
|
||||
\ingroup propale
|
||||
\brief Fiche d'information sur une proposition commerciale
|
||||
\version $Revision$
|
||||
\file htdocs/comm/propal/note.php
|
||||
\ingroup propale
|
||||
\brief Fiche d'information sur une proposition commerciale
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../../propal.class.php");
|
||||
require('./pre.inc.php');
|
||||
require('../../propal.class.php');
|
||||
|
||||
$langs->load("propal");
|
||||
$langs->load('propal');
|
||||
|
||||
$user->getrights('propale');
|
||||
if (!$user->rights->propale->lire)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
@ -44,20 +44,19 @@ if (!$user->rights->propale->lire)
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
unset($_GET["action"]);
|
||||
$socidp = $user->societe_id;
|
||||
unset($_GET['action']);
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
if ($_POST["action"] == 'update' && $user->rights->propale->creer)
|
||||
if ($_POST['action'] == 'update' && $user->rights->propale->creer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET["propalid"]);
|
||||
$propal->update_note($_POST["note"]);
|
||||
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
$propal->update_note($_POST['note']);
|
||||
}
|
||||
|
||||
llxHeader();
|
||||
@ -66,90 +65,87 @@ $html = new Form($db);
|
||||
/* Fin des Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
if ($_GET["propalid"])
|
||||
if ($_GET['propalid'])
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
if ( $propal->fetch($_GET["propalid"]) )
|
||||
{
|
||||
|
||||
$societe = new Societe($db);
|
||||
if ( $societe->fetch($propal->soc_id) )
|
||||
$propal = new Propal($db);
|
||||
if ( $propal->fetch($_GET['propalid']) )
|
||||
{
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Proposal").": $propal->ref");
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
if ($societe->client == 1)
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
|
||||
}
|
||||
print '<a href="'.$url.'">'.$societe->nom.'</a></td>';
|
||||
print '<td>'.$langs->trans("Status").'</td><td align="left">'.$propal->statut_libelle.'</td></tr>';
|
||||
$societe = new Societe($db);
|
||||
if ( $societe->fetch($propal->soc_id) )
|
||||
{
|
||||
$h=0;
|
||||
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.strftime("%A %d %B %Y",$propal->date);
|
||||
if ($propal->fin_validite)
|
||||
{
|
||||
print " (".strftime("%d %B %Y",$propal->fin_validite).")";
|
||||
}
|
||||
print '</td>';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Card');
|
||||
$h++;
|
||||
|
||||
print '<td>'.$langs->trans("Author").'</td><td>';
|
||||
$author = new User($db, $propal->user_author_id);
|
||||
$author->fetch('');
|
||||
print $author->fullname.'</td></tr>';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Note');
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
print '<tr><td valign="top" colspan="4">'.$langs->trans("Note").' :<br>'. nl2br($propal->note)."</td></tr>";
|
||||
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?propalid='.$propal->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<tr><td valign="top" colspan="4"><textarea name="note" cols="80" rows="8">'.$propal->note."</textarea></td></tr>";
|
||||
print '<tr><td align="center" colspan="4"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print '</form>';
|
||||
}
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Info');
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
$h++;
|
||||
|
||||
print "</table>";
|
||||
print '<br>';
|
||||
print '</div>';
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Proposal").": $propal->ref");
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->propale->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"note.php?propalid=$propal->id&action=edit\">".$langs->trans("Edit")."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
print '<tr><td>'.$langs->trans('Company').'</td><td>';
|
||||
if ($societe->client == 1)
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
|
||||
}
|
||||
print '<a href="'.$url.'">'.$societe->nom.'</a></td>';
|
||||
print '<td>'.$langs->trans('Status').'</td><td align="left">'.$propal->statut_libelle.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td>';
|
||||
print dolibarr_print_date($propal->date);
|
||||
if ($propal->fin_validite)
|
||||
{
|
||||
print ' ('.dolibarr_print_date($propal->fin_validite).')';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('Author').'</td><td>';
|
||||
$author = new User($db, $propal->user_author_id);
|
||||
$author->fetch('');
|
||||
print $author->fullname.'</td></tr>';
|
||||
|
||||
}
|
||||
print '<tr><td valign="top" colspan="4">'.$langs->trans('Note').' :<br>'. nl2br($propal->note).'</td></tr>';
|
||||
|
||||
if ($_GET['action'] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?propalid='.$propal->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<tr><td valign="top" colspan="4"><textarea name="note" cols="80" rows="8">'.$propal->note."</textarea></td></tr>";
|
||||
print '<tr><td align="center" colspan="4"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
if ($user->rights->propale->creer && $_GET['action'] <> 'edit')
|
||||
{
|
||||
print '<a class="tabAction" href="note.php?propalid='.$propal->id.'&action=edit">'.$langs->trans('Edit').'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$db->close();
|
||||
llxFooter('$Date$ - $Revision: 1.15 ');
|
||||
|
||||
@ -388,6 +388,51 @@ class Form
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche la liste déroulante des projets d'une société donnée
|
||||
*
|
||||
*/
|
||||
function select_projects($socid='', $selected='', $htmlname='projectid')
|
||||
{
|
||||
$socid=intVal($socid);
|
||||
if (empty($socid))
|
||||
return;
|
||||
// On recherche les societes
|
||||
$sql = 'SELECT p.rowid, p.title FROM ';
|
||||
$sql .= MAIN_DB_PREFIX .'projet as p';
|
||||
$sql .= ' WHERE fk_soc='.$socid;
|
||||
$sql .= ' ORDER BY p.title ASC';
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
if (!empty($selected) && $selected == $obj->rowid)
|
||||
{
|
||||
print '<option value="'.$obj->rowid.'" selected>'.$obj->title.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="'.$obj->rowid.'">'.$obj->title.'</option>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste des produits
|
||||
* \param selected Produit présélectionné
|
||||
|
||||
@ -7,4 +7,5 @@ AddProject=Add project
|
||||
DeleteAProject=Supprimer un projet
|
||||
ConfirmDeleteAProject=Are you sure you want to delete this project ?
|
||||
LastProjects=Last %s projects
|
||||
AllProjects=All projects
|
||||
AllProjects=All projects
|
||||
ShowProject=Show project
|
||||
|
||||
@ -31,4 +31,9 @@ ActionsOnPropal=Tasks on proposal
|
||||
NoOpenedPropals=No opened commercial proposals
|
||||
NoOtherOpenedPropals=No other opened commercial proposals
|
||||
RefProposal=Commercial proposal ref
|
||||
SendPropalByMail=Send commercial proposal by mail
|
||||
SendPropalByMail=Send commercial proposal by mail
|
||||
Documents=Documents
|
||||
FileNotUploaded=The file was not uploaded
|
||||
FileUploaded=The file was successfully uploaded
|
||||
AssociatedDocuments=Documents associated with the proposal:
|
||||
ErrorCantOpenDir=Can't open directory
|
||||
|
||||
@ -8,3 +8,4 @@ DeleteAProject=Supprimer un projet
|
||||
ConfirmDeleteAProject=Êtes-vous sûr de vouloir supprimer ce projet ?
|
||||
LastProjects=Les %s derniers projets
|
||||
AllProjects=Tous les projets
|
||||
ShowProject=Afficher projet
|
||||
|
||||
@ -31,4 +31,9 @@ ActionsOnPropal=Actions sur la proposition
|
||||
NoOpenedPropals=Pas de proposition ouverte
|
||||
NoOtherOpenedPropals=Pas d'autre proposition ouverte
|
||||
RefProposal=Réf proposition commerciale
|
||||
SendPropalByMail=Envoi proposition commerciale par mail
|
||||
SendPropalByMail=Envoi proposition commerciale par mail
|
||||
Documents=Documents
|
||||
FileNotUploaded=Le fichier n'a pas été téléchargé
|
||||
FileUploaded=Le fichier a été téléchargé avec succés
|
||||
AssociatedDocuments=Documents associés à la proposition :
|
||||
ErrorCantOpenDir=Impossible d'ouvrir le répertoire
|
||||
|
||||
@ -103,6 +103,32 @@ class Project {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Met à jour objet projet dans la base
|
||||
*/
|
||||
|
||||
function update()
|
||||
{
|
||||
$this->ref = ereg_replace("\"","",stripslashes($this->ref));
|
||||
$this->ref = ereg_replace("'","",stripslashes($this->ref));
|
||||
$this->ref = trim($this->ref);
|
||||
|
||||
$this->title = ereg_replace("\"","",stripslashes($this->title));
|
||||
$this->title = ereg_replace("'","",stripslashes($this->title));
|
||||
$this->title = trim($this->title);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet SET";
|
||||
$sql .= " ref='".$this->ref."', ";
|
||||
$sql .= " title='".$this->title."' ";
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
||||
@ -53,6 +53,8 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer)
|
||||
if ($_POST["action"] == 'update' && $user->rights->projet->creer)
|
||||
{
|
||||
if (! $_POST["cancel"]) {
|
||||
if (!(empty($_POST["id"]) || empty($_POST["ref"]) || empty($_POST["title"])))
|
||||
{
|
||||
$projet = new Project($db);
|
||||
$projet->id = $_POST["id"];
|
||||
$projet->ref = $_POST["ref"];
|
||||
@ -60,9 +62,14 @@ if ($_POST["action"] == 'update' && $user->rights->projet->creer)
|
||||
$projet->update();
|
||||
|
||||
$_GET["id"]=$projet->id; // On retourne sur la fiche projet
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
|
||||
}
|
||||
} else {
|
||||
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -545,7 +546,69 @@ class Propal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
function set_project($user, $project_id)
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
{
|
||||
//verif que le projet et la société concordent
|
||||
$sql = 'SELECT p.rowid, p.title FROM '.MAIN_DB_PREFIX.'projet as p WHERE p.fk_soc ='.$this->socidp.' AND p.rowid='.$project_id;
|
||||
$sqlres = $this->db->query($sql);
|
||||
if ($sqlres)
|
||||
{
|
||||
$numprojet = $this->db->num_rows($sqlres);
|
||||
if ($numprojet > 0)
|
||||
{
|
||||
$this->projetidp=$project_id;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_projet = '.$project_id;
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;';
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
function set_contact($user, $contact_id)
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
{
|
||||
//verif que le contact et la société concordent
|
||||
$sql = 'SELECT p.idp FROM '.MAIN_DB_PREFIX.'socpeople as p WHERE p.fk_soc = '.$this->socidp.' AND p.idp='.$contact_id;
|
||||
$sqlres = $this->db->query($sql);
|
||||
if ($sqlres)
|
||||
{
|
||||
$numprojet = $this->db->num_rows($sqlres);
|
||||
if ($numprojet > 0)
|
||||
{
|
||||
$this->projetidp=$project_id;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_soc_contact = '.$contact_id;
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;';
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
||||
@ -927,7 +927,7 @@ class Societe {
|
||||
* \brief Renvoie la liste des contacts de cette société
|
||||
* \return array tableau des contacts
|
||||
*/
|
||||
|
||||
|
||||
function contact_array()
|
||||
{
|
||||
$contacts = array();
|
||||
@ -1253,6 +1253,30 @@ class Societe {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Indique si la société a des projets
|
||||
* \return bool true si la société a des projets, false sinon
|
||||
*/
|
||||
function has_projects()
|
||||
{
|
||||
$sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows($resql);
|
||||
$obj = $this->db->fetch_object();
|
||||
$count = $obj->numproj;
|
||||
}
|
||||
else
|
||||
{
|
||||
$count = 0;
|
||||
print $this->db->error();
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return ($count > 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user