Look: Les caractristiques complexes (projet, rib...) au sein des onglets se modifient par le bouton modifier insrer l'emplacement mme de la carac.
This commit is contained in:
parent
914b28dd5e
commit
fa81f25351
@ -71,7 +71,7 @@ $NBLINES=4;
|
||||
if ($_POST["action"] == 'classin')
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
$facture->fetch($_POST["facid"]);
|
||||
$facture->fetch($_GET["facid"]);
|
||||
$facture->classin($_POST["projetid"]);
|
||||
}
|
||||
|
||||
@ -884,7 +884,7 @@ else
|
||||
*/
|
||||
if ($_GET["action"] == 'canceled')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?facid=$fac->id","Classer la facture à l'état 'Abandonnée'","La totalité du paiement de cette facture n'a pas été réalisée. Etes-vous sûr de vouloir abandonner définitivement cette facture ?","confirm_canceled");
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?facid=$fac->id",$langs->trans("CancelBill"),$langs->trans("ConfirmCancelBill"),"confirm_canceled");
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
@ -916,25 +916,31 @@ else
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr>';
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<td height=\"10\">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
if ($fac->projetid > 0)
|
||||
{
|
||||
$projet = New Project($db);
|
||||
$projet->fetch($fac->projetid);
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$fac->projetid.'">'.$projet->title.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="facture.php?facid='.$fac->id.'&action=classer">'.$langs->trans("ClassifyBill").'</a>';
|
||||
}
|
||||
print " </td>";
|
||||
|
||||
// Projet
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans("Project");
|
||||
print '</td>';
|
||||
if ($_GET["action"] != "classer") print '<td align="right"><a href="facture.php?action=classer&facid='.$fac->id.'">'.img_edit($langs->trans("SetProject")).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET["action"] == "classer")
|
||||
{
|
||||
$html->form_project("facture.php?facid=$fac->id",$fac->fk_soc,$fac->projetid,"projetid");
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_project("facture.php?facid=$fac->id",$fac->fk_soc,$fac->projetid,"none");
|
||||
}
|
||||
print "</td>";
|
||||
} else {
|
||||
print '<td height=\"10\"> </td><td colspan="3">';
|
||||
print " </td>";
|
||||
print '<td height=\"10\"> </td><td colspan="3"> </td>';
|
||||
}
|
||||
|
||||
print '<td rowspan="8" colspan="2" valign="top">';
|
||||
|
||||
/*
|
||||
@ -1456,27 +1462,6 @@ else
|
||||
print "</td></tr></table>";
|
||||
|
||||
|
||||
/*
|
||||
* Choix d'un projet
|
||||
*/
|
||||
if ($_GET["action"] == 'classer')
|
||||
{
|
||||
print "<p><form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."?facid=$fac->id\">\n";
|
||||
print '<input type="hidden" name="facid" value="'.$fac->id.'">';
|
||||
print '<input type="hidden" name="action" value="classin">';
|
||||
print '<table class="border">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
$proj = new Project($db);
|
||||
$html->select_array("projetid",$proj->liste_array($soc->id));
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr></table></form></p>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affiche formulaire mail
|
||||
*/
|
||||
|
||||
@ -51,7 +51,9 @@ class Contrat
|
||||
|
||||
var $commercial_signature_id;
|
||||
var $commercial_suivi_id;
|
||||
|
||||
|
||||
var $fk_projet;
|
||||
|
||||
var $statuts=array();
|
||||
|
||||
|
||||
@ -274,11 +276,12 @@ class Contrat
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT rowid, statut, fk_soc, ".$this->db->pdate("mise_en_service")." as datemise";
|
||||
$sql .= ", fk_user_mise_en_service, ".$this->db->pdate("date_contrat")." as datecontrat";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", fk_commercial_signature, fk_commercial_suivi ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat WHERE rowid = $id";
|
||||
$sql = "SELECT rowid, statut, fk_soc, ".$this->db->pdate("mise_en_service")." as datemise,";
|
||||
$sql.= " fk_user_mise_en_service, ".$this->db->pdate("date_contrat")." as datecontrat,";
|
||||
$sql.= " fk_user_author,";
|
||||
$sql.= " fk_projet,";
|
||||
$sql.= " fk_commercial_signature, fk_commercial_suivi ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat WHERE rowid = $id";
|
||||
|
||||
$resql = $this->db->query($sql) ;
|
||||
|
||||
@ -302,6 +305,8 @@ class Contrat
|
||||
|
||||
$this->user_service->id = $result["fk_user_mise_en_service"];
|
||||
$this->user_cloture->id = $result["fk_user_cloture"];
|
||||
|
||||
$this->fk_projet = $result["fk_projet"];
|
||||
|
||||
$this->societe->fetch($result["fk_soc"]);
|
||||
|
||||
@ -541,6 +546,29 @@ class Contrat
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Classe le contrat dans un projet
|
||||
* \param projid Id du projet dans lequel classer le contrat
|
||||
*/
|
||||
function classin($projid)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat";
|
||||
if ($projid) $sql.= " SET fk_projet = $projid";
|
||||
else $sql.= " SET fk_projet = NULL";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le libellé du statut du contrat
|
||||
* \return string Libellé
|
||||
@ -612,6 +640,41 @@ class Contrat
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Récupère les lignes de detail du contrat
|
||||
* \param statut Statut des lignes detail à récupérer
|
||||
* \return array Tableau des lignes de details
|
||||
*/
|
||||
function array_detail($statut=-1)
|
||||
{
|
||||
$tab=array();
|
||||
|
||||
$sql = "SELECT cd.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " WHERE fk_contrat =".$this->id;
|
||||
if ($statut >= 0) $sql.= " AND statut = '$statut'";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num=$this->db->num_rows($result);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$tab[$i]=$obj->rowid;
|
||||
$i++;
|
||||
}
|
||||
return $tab;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -534,16 +534,21 @@ else
|
||||
// Projet
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
if ($contrat->projet_id > 0)
|
||||
$langs->load("projects");
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans("Project");
|
||||
print '</td>';
|
||||
if ($_GET["action"] != "classer") print '<td align="right"><a href="fiche.php?action=classer&id='.$id.'">'.img_edit($langs->trans("SetProject")).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET["action"] == "classer")
|
||||
{
|
||||
$projet = New Project($db);
|
||||
$projet->fetch($contrat->projet_id);
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$contrat->projet_id.'">'.$projet->title.'</a>';
|
||||
$html->form_project("fiche.php?id=$id",$contrat->fk_soc,$contrat->fk_projet,"projetid");
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="fiche.php?id='.$id.'&action=classer">Classer le contrat</a>';
|
||||
$html->form_project("fiche.php?id=$id",$contrat->fk_soc,$contrat->fk_projet,"none");
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
@ -831,9 +836,8 @@ else
|
||||
print '<a class="butAction" href="fiche.php?id='.$id.'&action=valid">'.$langs->trans("Valid").'</a>';
|
||||
}
|
||||
|
||||
// \todo Mettre bouton cloturer que si tous les services sont clos
|
||||
$numclos=$num;
|
||||
if ($contrat->statut == 1 && $num == $numclos)
|
||||
$numclos=$contrat->array_detail(5); // Tableau des lignes au statut clos
|
||||
if ($contrat->statut == 1 && $num == sizeof($numclos))
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$id.'&action=close">'.$langs->trans("Close").'</a>';
|
||||
}
|
||||
@ -846,29 +850,10 @@ else
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($_GET["action"] == 'classer')
|
||||
{
|
||||
$langs->load("project");
|
||||
print '<p><form method="post" action="fiche.php?id='.$contrat->id.'">';
|
||||
print '<input type="hidden" name="action" value="classin">';
|
||||
print '<table class="border">';
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
$proj = new Project($db);
|
||||
$html->select_array("projetid",$proj->liste_array($contrat->soc_id));
|
||||
|
||||
print "</td></tr>";
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="Envoyer"></td></tr></table></form>';
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Contrat non trouvée */
|
||||
// Contrat non trouvé
|
||||
print "Contrat inexistant ou accés refusé";
|
||||
}
|
||||
}
|
||||
|
||||
@ -530,22 +530,24 @@ class Facture
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Classe la facture
|
||||
* \param cat_id id de la catégorie dans laquelle classer la facture
|
||||
*
|
||||
*/
|
||||
function classin($cat_id)
|
||||
* \brief Classe la facture dans un projet
|
||||
* \param projid Id du projet dans lequel classer la facture
|
||||
*/
|
||||
function classin($projid)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET fk_projet = $cat_id";
|
||||
$sql .= " WHERE rowid = $this->id;";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
|
||||
if ($projid) $sql.= " SET fk_projet = $projid";
|
||||
else $sql.= " SET fk_projet = NULL";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -398,14 +398,11 @@ class Form
|
||||
*/
|
||||
function select_projects($socid='', $selected='', $htmlname='projectid')
|
||||
{
|
||||
$socid=intVal($socid);
|
||||
if (empty($socid))
|
||||
return;
|
||||
// On recherche les societes
|
||||
// On recherche les projets
|
||||
$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';
|
||||
$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)
|
||||
@ -781,6 +778,40 @@ class Form
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche formulaire de selection de projet
|
||||
* \param page Page
|
||||
* \param socid Id societe
|
||||
* \param selected Id projet présélectionné
|
||||
* \param htmlname Nom du formulaire select
|
||||
*/
|
||||
function form_project($page, $socid, $selected='', $htmlname='projectid')
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("project");
|
||||
if ($htmlname != "none")
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="classin">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_projects($soc_id,$selected,$htmlname);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($selected) {
|
||||
$projet = New Project($this->db);
|
||||
$projet->fetch($selected);
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$selected.'">'.$projet->title.'</a>';
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste des devies, dans la langue de l'utilisateur
|
||||
* \param selected code devise pré-sélectionnée
|
||||
|
||||
@ -9,4 +9,5 @@ ConfirmDeleteAProject=Are you sure you want to delete this project ?
|
||||
LastProjects=Last %s projects
|
||||
AllProjects=All projects
|
||||
ShowProject=Show project
|
||||
SetProject=Set project
|
||||
NoProject=No project defined
|
||||
@ -9,4 +9,5 @@ ConfirmDeleteAProject=
|
||||
LastProjects=Les %s derniers projets
|
||||
AllProjects=Tous les projets
|
||||
ShowProject=Afficher projet
|
||||
SetProject=Définir projet
|
||||
NoProject=Aucun projet défini
|
||||
@ -572,7 +572,7 @@ else
|
||||
|
||||
// RIB
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="noborder" cellpadding="0" cellspacing="0" border="0"><tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('RIB');
|
||||
print '<td><td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id.'">'.img_edit().'</a>';
|
||||
@ -584,7 +584,7 @@ else
|
||||
|
||||
// Maison mère
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="noborder" cellpadding="0" cellspacing="0" border="0"><tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('ParentCompany');
|
||||
print '<td><td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/lien.php?socid='.$soc->id.'">'.img_edit() .'</a>';
|
||||
@ -604,7 +604,7 @@ else
|
||||
|
||||
// Commerciaux
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="noborder" cellpadding="0" cellspacing="0" border="0"><tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SalesRepresentatives');
|
||||
print '<td><td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$soc->id.'">'.img_edit().'</a>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user