New: add new notes system in contract and order/invoice supplier module
This commit is contained in:
parent
55af663784
commit
d752e25946
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -62,7 +62,6 @@ else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Affichage fiche */
|
||||
/******************************************************************************/
|
||||
@ -149,7 +148,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
|
||||
|
||||
print '</div>';
|
||||
dol_fiche_end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -27,9 +27,6 @@
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/price.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
* \class Contrat
|
||||
@ -59,11 +56,14 @@ class Contrat extends CommonObject
|
||||
var $commercial_signature_id;
|
||||
var $commercial_suivi_id;
|
||||
|
||||
var $note;
|
||||
var $note; // deprecated
|
||||
var $note_private;
|
||||
var $note_public;
|
||||
|
||||
var $fk_projet;
|
||||
|
||||
|
||||
var $extraparams=array();
|
||||
|
||||
var $lines=array();
|
||||
|
||||
|
||||
@ -75,8 +75,6 @@ class Contrat extends CommonObject
|
||||
function Contrat($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->product = new Product($db);
|
||||
$this->societe = new Societe($db);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -323,7 +321,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " fk_user_author,";
|
||||
$sql.= " fk_projet,";
|
||||
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
|
||||
$sql.= " note, note_public";
|
||||
$sql.= " note as note_private, note_public, extraparams";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
|
||||
if ($ref) $sql.= " WHERE ref='".$ref."'";
|
||||
else $sql.= " WHERE rowid=".$id;
|
||||
@ -336,25 +334,27 @@ class Contrat extends CommonObject
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $result["rowid"];
|
||||
$this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"];
|
||||
$this->statut = $result["statut"];
|
||||
$this->mise_en_service = $this->db->jdate($result["datemise"]);
|
||||
$this->date_contrat = $this->db->jdate($result["datecontrat"]);
|
||||
$this->id = $result["rowid"];
|
||||
$this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"];
|
||||
$this->statut = $result["statut"];
|
||||
$this->mise_en_service = $this->db->jdate($result["datemise"]);
|
||||
$this->date_contrat = $this->db->jdate($result["datecontrat"]);
|
||||
|
||||
$this->user_author_id = $result["fk_user_author"];
|
||||
$this->user_author_id = $result["fk_user_author"];
|
||||
|
||||
$this->commercial_signature_id = $result["fk_commercial_signature"];
|
||||
$this->commercial_suivi_id = $result["fk_commercial_suivi"];
|
||||
$this->commercial_signature_id = $result["fk_commercial_signature"];
|
||||
$this->commercial_suivi_id = $result["fk_commercial_suivi"];
|
||||
|
||||
$this->note = $result["note"];
|
||||
$this->note_public = $result["note_public"];
|
||||
$this->note = $result["note_private"]; // deprecated
|
||||
$this->note_private = $result["note_private"];
|
||||
$this->note_public = $result["note_public"];
|
||||
|
||||
$this->fk_projet = $result["fk_projet"];
|
||||
$this->fk_projet = $result["fk_projet"];
|
||||
|
||||
$this->socid = $result["fk_soc"];
|
||||
$this->fk_soc = $result["fk_soc"];
|
||||
$this->societe->fetch($result["fk_soc"]); // TODO A virer car la societe doit etre chargee par appel de fetch_client()
|
||||
$this->socid = $result["fk_soc"];
|
||||
$this->fk_soc = $result["fk_soc"];
|
||||
|
||||
$this->extraparams = (array) dol_json_decode($result["extraparams"], true);
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -32,71 +33,73 @@ require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$langs->load("contracts");
|
||||
$langs->load("companies");
|
||||
|
||||
$contratid = isset($_GET["id"])?$_GET["id"]:'';
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$socid = GETPOST('socid','int');
|
||||
$id = GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contrat', $contratid);
|
||||
$result=restrictedArea($user,'contrat',$id);
|
||||
|
||||
$object = new Contrat($db);
|
||||
|
||||
|
||||
/*
|
||||
* Ajout d'un nouveau contact
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'addcontact' && $user->rights->contrat->creer)
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result = 0;
|
||||
$contrat = new Contrat($db);
|
||||
$result = $contrat->fetch($_GET["id"]);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $_POST["id"] > 0)
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$result = $contrat->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: contact.php?id=".$contrat->id);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($contrat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$contrat->error.'</div>';
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
if ($_GET["action"] == 'swapstatut' && $user->rights->contrat->creer)
|
||||
if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
||||
{
|
||||
$contrat = new Contrat($db);
|
||||
if ($contrat->fetch(GETPOST('id','int')))
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$contrat->swapContactStatus(GETPOST('ligne'));
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$contrat->error);
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
if ($_GET["action"] == 'deleteline' && $user->rights->contrat->creer)
|
||||
if ($action == 'deletecontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$contrat = new Contrat($db);
|
||||
$contrat->fetch($_GET["id"]);
|
||||
$result = $contrat->delete_contact($_GET["lineid"]);
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: contact.php?id=".$contrat->id);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -120,18 +123,16 @@ dol_htmloutput_mesg($mesg);
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
$id = $_GET["id"];
|
||||
if ($id > 0)
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$contrat = New Contrat($db);
|
||||
if ($contrat->fetch($id) > 0)
|
||||
if ($object->fetch($id, $ref) > 0)
|
||||
{
|
||||
if ($mesg) print $mesg;
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($contrat->socid);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = contract_prepare_head($contrat);
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
$hselected=1;
|
||||
|
||||
@ -144,18 +145,18 @@ if ($id > 0)
|
||||
|
||||
// Reference du contrat
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $contrat->ref;
|
||||
print $object->ref;
|
||||
print "</td></tr>";
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Customer")."</td>";
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
||||
if ($contrat->societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$contrat->societe->remise_client);
|
||||
if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$contrat->societe->getAvailableDiscounts();
|
||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
@ -164,192 +165,12 @@ if ($id > 0)
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Lignes de contacts
|
||||
*/
|
||||
echo '<br><table class="noborder" width="100%">';
|
||||
|
||||
/*
|
||||
* Ajouter une ligne de contact
|
||||
* Non affich<EFBFBD> en mode modification de ligne
|
||||
*/
|
||||
if ($_GET["action"] != 'editline' && $user->rights->contrat->creer)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||
print '<td colspan="3"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var = false;
|
||||
|
||||
print '<form action="contact.php?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addcontact">';
|
||||
print '<input type="hidden" name="source" value="internal">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
// Ligne ajout pour contact interne
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
print img_object('','user').' '.$langs->trans("Users");
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
//$userAlreadySelected = $contrat->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||
$form->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formcompany->selectTypeContact($contrat, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<form action="contact.php?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addcontact">';
|
||||
print '<input type="hidden" name="source" value="external">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
// Ligne ajout pour contact externe
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$contrat->societe->id;
|
||||
$selectedCompany = $formcompany->selectCompaniesForNewContact($contrat, 'id', $selectedCompany, 'newcompany');
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
$nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid');
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formcompany->selectTypeContact($contrat, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="disabled"';
|
||||
print '></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</form>";
|
||||
|
||||
}
|
||||
|
||||
print '<tr><td colspan="6"> </td></tr>';
|
||||
|
||||
// Liste des contacts li<6C>s
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$var = true;
|
||||
|
||||
foreach(array('internal','external') as $source)
|
||||
{
|
||||
$tab = $contrat->liste_contact(-1,$source);
|
||||
$num=count($tab);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
print '<tr '.$bc[$var].' valign="top">';
|
||||
|
||||
// Source
|
||||
print '<td align="left">';
|
||||
if ($tab[$i]['source']=='internal') print $langs->trans("User");
|
||||
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
|
||||
print '</td>';
|
||||
|
||||
// Societe
|
||||
print '<td align="left">';
|
||||
if ($tab[$i]['socid'] > 0)
|
||||
{
|
||||
$companystatic->fetch($tab[$i]['socid']);
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
if ($tab[$i]['socid'] < 0)
|
||||
{
|
||||
print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
}
|
||||
if (! $tab[$i]['socid'])
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Contact
|
||||
print '<td>';
|
||||
if ($tab[$i]['source']=='internal')
|
||||
{
|
||||
$userstatic->id=$tab[$i]['id'];
|
||||
$userstatic->lastname=$tab[$i]['lastname'];
|
||||
$userstatic->firstname=$tab[$i]['firstname'];
|
||||
print $userstatic->getNomUrl(1);
|
||||
}
|
||||
if ($tab[$i]['source']=='external')
|
||||
{
|
||||
$contactstatic->id=$tab[$i]['id'];
|
||||
$contactstatic->lastname=$tab[$i]['lastname'];
|
||||
$contactstatic->firstname=$tab[$i]['firstname'];
|
||||
print $contactstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Type de contact
|
||||
print '<td>'.$tab[$i]['libelle'].'</td>';
|
||||
|
||||
// Statut
|
||||
print '<td align="center">';
|
||||
// Activation desativation du contact
|
||||
if ($contrat->statut >= 0) print '<a href="'.DOL_URL_ROOT.'/contrat/contact.php?id='.$contrat->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||
if ($contrat->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon delete
|
||||
print '<td align="center" nowrap>';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
print ' ';
|
||||
print '<a href="contact.php?id='.$contrat->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php');
|
||||
|
||||
}
|
||||
else
|
||||
@ -358,7 +179,7 @@ if ($id > 0)
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -27,11 +27,13 @@
|
||||
|
||||
require ("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/price.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/modules/contract/modules_contract.php");
|
||||
if ($conf->produit->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
|
||||
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||
if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
|
||||
|
||||
$langs->load("contracts");
|
||||
@ -40,13 +42,15 @@ $langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load("products");
|
||||
|
||||
$action=GETPOST('action');
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$socid = GETPOST('socid','int');
|
||||
$contratid = GETPOST('id','int');
|
||||
$id = GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'contrat',$contratid,'contrat');
|
||||
$result=restrictedArea($user,'contrat',$id);
|
||||
|
||||
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||
|
||||
@ -57,14 +61,14 @@ $object = new Contrat($db);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'confirm_active' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->activer)
|
||||
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer)
|
||||
{
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
$result = $object->active_line($user, $_GET["ligne"], $_GET["date"], $_GET["dateend"], $_GET["comment"]);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$object->id);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
@ -72,14 +76,14 @@ if ($action == 'confirm_active' && $_REQUEST["confirm"] == 'yes' && $user->right
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_closeline' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->activer)
|
||||
else if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer)
|
||||
{
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
$result = $object->close_line($user, $_GET["ligne"], $_GET["dateend"], urldecode($_GET["comment"]));
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$object->id);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
@ -144,25 +148,24 @@ if ($_POST["remonth"] && $_POST["reday"] && $_POST["reyear"])
|
||||
$datecontrat = dol_mktime($_POST["rehour"], $_POST["remin"], 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
}
|
||||
|
||||
if ($action == 'add')
|
||||
else if ($action == 'add' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->socid = $_POST["socid"];
|
||||
$object->date_contrat = $datecontrat;
|
||||
$object->socid = $socid;
|
||||
$object->date_contrat = $datecontrat;
|
||||
|
||||
$object->commercial_suivi_id = $_POST["commercial_suivi_id"];
|
||||
$object->commercial_signature_id = $_POST["commercial_signature_id"];
|
||||
$object->commercial_suivi_id = $_POST["commercial_suivi_id"];
|
||||
$object->commercial_signature_id = $_POST["commercial_signature_id"];
|
||||
|
||||
$object->note = trim($_POST["note"]);
|
||||
$object->fk_project = trim($_POST["projectid"]);
|
||||
$object->remise_percent = trim($_POST["remise_percent"]);
|
||||
$object->ref = trim($_POST["ref"]);
|
||||
$object->note = trim($_POST["note"]);
|
||||
$object->fk_project = trim($_POST["projectid"]);
|
||||
$object->remise_percent = trim($_POST["remise_percent"]);
|
||||
$object->ref = trim($_POST["ref"]);
|
||||
|
||||
// Check
|
||||
if (empty($datecontrat))
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
|
||||
$_GET["socid"]=$_POST["socid"];
|
||||
$action='create';
|
||||
}
|
||||
|
||||
@ -171,28 +174,27 @@ if ($action == 'add')
|
||||
$result = $object->create($user,$langs,$conf);
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$object->id);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
$_GET["socid"]=$_POST["socid"];
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'classin')
|
||||
else if ($action == 'classin' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
$object->setProject($_POST["projectid"]);
|
||||
}
|
||||
|
||||
if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($_POST["pqty"] && (($_POST["pu"] != '' && $_POST["desc"]) || $_POST["idprod"]))
|
||||
{
|
||||
$ret=$object->fetch($_GET["id"]);
|
||||
$ret=$object->fetch($id);
|
||||
if ($ret < 0)
|
||||
{
|
||||
dol_print_error($db,$object->error);
|
||||
@ -340,9 +342,9 @@ if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'updateligne' && $user->rights->contrat->creer && ! $_POST["cancel"])
|
||||
else if ($action == 'updateligne' && $user->rights->contrat->creer && ! $_POST["cancel"])
|
||||
{
|
||||
$ret=$object->fetch($_GET["id"]);
|
||||
$ret=$object->fetch($id);
|
||||
if ($ret < 0)
|
||||
{
|
||||
dol_print_error($db,$object->error);
|
||||
@ -394,14 +396,14 @@ if ($action == 'updateligne' && $user->rights->contrat->creer && ! $_POST["cance
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_deleteline' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer)
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
$result = $object->deleteline($_GET["lineid"],$user);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$object->id);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -410,62 +412,128 @@ if ($action == 'confirm_deleteline' && $_REQUEST["confirm"] == 'yes' && $user->r
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer)
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
$result = $object->validate($user,$langs,$conf);
|
||||
}
|
||||
|
||||
// Close all lines
|
||||
if ($action == 'confirm_close' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer)
|
||||
else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
$result = $object->cloture($user,$langs,$conf);
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer)
|
||||
{
|
||||
if ($user->rights->contrat->supprimer)
|
||||
{
|
||||
$object->id = $_GET["id"];
|
||||
$result=$object->delete($user,$langs,$conf);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
$object->fetch($id);
|
||||
$result=$object->delete($user,$langs,$conf);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_move' && $_REQUEST["confirm"] == 'yes')
|
||||
else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($_POST['newcid'] > 0)
|
||||
{
|
||||
$contractline = new ContratLigne($db);
|
||||
$result=$contractline->fetch($_GET["lineid"]);
|
||||
$contractline->fk_contrat = $_POST["newcid"];
|
||||
$result=$contractline->update($user,1);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF'].'?id='.$_GET['id']);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'</div>';
|
||||
}
|
||||
}
|
||||
if ($_POST['newcid'] > 0)
|
||||
{
|
||||
$contractline = new ContratLigne($db);
|
||||
$result=$contractline->fetch($_GET["lineid"]);
|
||||
$contractline->fk_contrat = $_POST["newcid"];
|
||||
$result=$contractline->update($user,1);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -475,7 +543,6 @@ if ($action == 'confirm_move' && $_REQUEST["confirm"] == 'yes')
|
||||
|
||||
llxHeader('',$langs->trans("ContractCard"),"Contrat");
|
||||
|
||||
$form = new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$objectlignestatic=new ContratLigne($db);
|
||||
@ -500,7 +567,7 @@ if ($action == 'create')
|
||||
|
||||
$numct = $object->getNextNumRef($soc);
|
||||
|
||||
print '<form name="contrat" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<form name="form_contract" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -578,14 +645,11 @@ else
|
||||
{
|
||||
$now=dol_now();
|
||||
|
||||
$id = $_GET["id"];
|
||||
$ref= $_GET['ref'];
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$result=$object->fetch($_GET['id'],$_GET['ref']);
|
||||
$result=$object->fetch($id,$ref);
|
||||
if ($result > 0)
|
||||
{
|
||||
$id = $object->id; // if $_GET['ref']
|
||||
$result=$object->fetch_lines();
|
||||
}
|
||||
if ($result < 0)
|
||||
@ -595,6 +659,8 @@ else
|
||||
}
|
||||
|
||||
dol_htmloutput_errors($mesg,'');
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$nbofservices=count($object->lines);
|
||||
|
||||
@ -619,7 +685,7 @@ else
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1);
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
@ -629,7 +695,7 @@ else
|
||||
if ($action == 'valid')
|
||||
{
|
||||
//$numfa = contrat_get_num($soc);
|
||||
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid",'',0,1);
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid",'',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
@ -638,7 +704,7 @@ else
|
||||
*/
|
||||
if ($action == 'close')
|
||||
{
|
||||
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
@ -647,7 +713,7 @@ else
|
||||
*/
|
||||
if ($object->brouillon && $user->rights->contrat->creer)
|
||||
{
|
||||
print '<form action="fiche.php?id='.$id.'" method="post">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setremise">';
|
||||
}
|
||||
@ -661,13 +727,13 @@ else
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Customer")."</td>";
|
||||
print '<td colspan="3">'.$object->societe->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discount').'</td><td colspan="3">';
|
||||
if ($object->societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->societe->remise_client);
|
||||
if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$object->societe->getAvailableDiscounts();
|
||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
@ -692,16 +758,16 @@ else
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans("Project");
|
||||
print '</td>';
|
||||
if ($action != "classify" && $user->rights->projet->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classify&id='.$id.'">'.img_edit($langs->trans("SetProject")).'</a></td>';
|
||||
if ($action != "classify" && $user->rights->projet->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classify&id='.$object->id.'">'.img_edit($langs->trans("SetProject")).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == "classify")
|
||||
{
|
||||
$form->form_project("fiche.php?id=$id",$object->socid,$object->fk_project,"projectid");
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id,$object->socid,$object->fk_project,"projectid");
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->form_project("fiche.php?id=$id",$object->socid,$object->fk_project,"none");
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id,$object->socid,$object->fk_project,"none");
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
@ -714,6 +780,24 @@ else
|
||||
}
|
||||
|
||||
echo '<br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
|
||||
$servicepos=(isset($_REQUEST["servicepos"])?$_REQUEST["servicepos"]:1);
|
||||
$colorb='666666';
|
||||
@ -724,9 +808,11 @@ else
|
||||
* Lines of contracts
|
||||
*/
|
||||
$productstatic=new Product($db);
|
||||
|
||||
|
||||
// TODO move css and DAO
|
||||
|
||||
// Title line for service
|
||||
print '<table class="notopnoleft" width="100%">'; // Array with (n*2)+1 lines
|
||||
print '<table class="notopnoleft allwidth">'; // Array with (n*2)+1 lines
|
||||
$cursorline=1;
|
||||
while ($cursorline <= $nbofservices)
|
||||
{
|
||||
@ -769,7 +855,7 @@ else
|
||||
|
||||
$var=!$var;
|
||||
|
||||
if ($_REQUEST["action"] != 'editline' || $_GET["rowid"] != $objp->rowid)
|
||||
if ($action != 'editline' || $_GET["rowid"] != $objp->rowid)
|
||||
{
|
||||
print '<tr '.$bc[$var].' valign="top">';
|
||||
// Libelle
|
||||
@ -807,7 +893,7 @@ else
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0))
|
||||
{
|
||||
print '<a href="fiche.php?id='.$object->id.'&action=move&rowid='.$objp->rowid.'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=move&rowid='.$objp->rowid.'">';
|
||||
print img_picto($langs->trans("MoveToAnotherContract"),'uparrow');
|
||||
print '</a>';
|
||||
}
|
||||
@ -816,7 +902,7 @@ else
|
||||
}
|
||||
if ($user->rights->contrat->creer && ($object->statut >= 0))
|
||||
{
|
||||
print '<a href="fiche.php?id='.$object->id.'&action=editline&rowid='.$objp->rowid.'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editline&rowid='.$objp->rowid.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
}
|
||||
@ -826,7 +912,7 @@ else
|
||||
if ( $user->rights->contrat->creer && ($object->statut >= 0))
|
||||
{
|
||||
print ' ';
|
||||
print '<a href="fiche.php?id='.$object->id.'&action=deleteline&rowid='.$objp->rowid.'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=deleteline&rowid='.$objp->rowid.'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
@ -865,7 +951,7 @@ else
|
||||
// Ligne en mode update
|
||||
else
|
||||
{
|
||||
print "<form name='update' action=\"fiche.php?id=$id\" method=\"post\">";
|
||||
print '<form name="update" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateligne">';
|
||||
print '<input type="hidden" name="elrowid" value="'.$_GET["rowid"].'">';
|
||||
@ -887,7 +973,7 @@ else
|
||||
}
|
||||
print '<textarea name="eldesc" cols="70" rows="1">'.$objp->description.'</textarea></td>';
|
||||
print '<td align="right">';
|
||||
print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->societe);
|
||||
print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->thirdparty);
|
||||
print '</td>';
|
||||
print '<td align="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||
print '<td align="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>';
|
||||
@ -928,7 +1014,7 @@ else
|
||||
/*
|
||||
* Confirmation to delete service line of contract
|
||||
*/
|
||||
if ($_REQUEST["action"] == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"])
|
||||
if ($action == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"])
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".$_GET["rowid"],$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1);
|
||||
if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
@ -937,7 +1023,7 @@ else
|
||||
/*
|
||||
* Confirmation to move service toward another contract
|
||||
*/
|
||||
if ($_REQUEST["action"] == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"])
|
||||
if ($action == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"])
|
||||
{
|
||||
$arraycontractid=array();
|
||||
foreach($arrayothercontracts as $contractcursor)
|
||||
@ -957,7 +1043,7 @@ else
|
||||
/*
|
||||
* Confirmation de la validation activation
|
||||
*/
|
||||
if ($_REQUEST["action"] == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
if ($action == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
{
|
||||
$dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
$dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
|
||||
@ -969,7 +1055,7 @@ else
|
||||
/*
|
||||
* Confirmation de la validation fermeture
|
||||
*/
|
||||
if ($_REQUEST["action"] == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
if ($action == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
{
|
||||
$dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
$dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
|
||||
@ -989,7 +1075,7 @@ else
|
||||
print '<td width="30" align="right">';
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
if ($object->statut > 0 && $_REQUEST["action"] != 'activateline' && $_REQUEST["action"] != 'unactivateline')
|
||||
if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline')
|
||||
{
|
||||
$action='activateline';
|
||||
if ($objp->statut == 4) $action='unactivateline';
|
||||
@ -1032,7 +1118,7 @@ else
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->activer && $_REQUEST["action"] == 'activateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
{
|
||||
/**
|
||||
* Activer la ligne de contrat
|
||||
@ -1082,7 +1168,7 @@ else
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->activer && $_REQUEST["action"] == 'unactivateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
{
|
||||
/**
|
||||
* Desactiver la ligne de contrat
|
||||
@ -1161,17 +1247,17 @@ else
|
||||
$var=false;
|
||||
|
||||
// Service sur produit predefini
|
||||
print '<form name="addline" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">';
|
||||
print '<form name="addline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addline">';
|
||||
print '<input type="hidden" name="mode" value="predefined">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="3">';
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES)
|
||||
$form->select_produits('','idprod',1,$conf->product->limit_size,$object->societe->price_level);
|
||||
$form->select_produits('','idprod',1,$conf->product->limit_size,$object->thirdparty->price_level);
|
||||
else
|
||||
$form->select_produits('','idprod',1,$conf->product->limit_size);
|
||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||
@ -1179,7 +1265,7 @@ else
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
|
||||
print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="'.$object->societe->remise_client.'">%</td>';
|
||||
print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="'.$object->thirdparty->remise_client.'">%</td>';
|
||||
print '<td align="center" colspan="2" rowspan="2"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
@ -1197,21 +1283,21 @@ else
|
||||
$var=!$var;
|
||||
|
||||
// Service libre
|
||||
print '<form name="addline_sl" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">';
|
||||
print '<form name="addline_sl" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addline">';
|
||||
print '<input type="hidden" name="mode" value="libre">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
|
||||
|
||||
print '<td>';
|
||||
print $form->load_tva("tva_tx",-1,$mysoc,$object->societe);
|
||||
print $form->load_tva("tva_tx",-1,$mysoc,$object->thirdparty);
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" class="flat" size="4" name="pu" value=""></td>';
|
||||
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
|
||||
print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="'.$object->societe->remise_client.'">%</td>';
|
||||
print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="'.$object->thirdparty->remise_client.'">%</td>';
|
||||
print '<td align="center" rowspan="2" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
@ -1249,14 +1335,14 @@ else
|
||||
|
||||
if ($object->statut == 0 && $nbofservices)
|
||||
{
|
||||
if ($user->rights->contrat->creer) print '<a class="butAction" href="fiche.php?id='.$id.'&action=valid">'.$langs->trans("Validate").'</a>';
|
||||
if ($user->rights->contrat->creer) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid">'.$langs->trans("Validate").'</a>';
|
||||
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a>';
|
||||
}
|
||||
|
||||
if ($conf->facture->enabled && $object->statut > 0)
|
||||
{
|
||||
$langs->load("bills");
|
||||
if ($user->rights->facture->creer) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->societe->id.'">'.$langs->trans("CreateBill").'</a>';
|
||||
if ($user->rights->facture->creer) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateBill").'</a>';
|
||||
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
|
||||
@ -1264,7 +1350,7 @@ else
|
||||
{
|
||||
//if (! $numactive)
|
||||
//{
|
||||
print '<a class="butAction" href="fiche.php?id='.$id.'&action=close">'.$langs->trans("CloseAllContracts").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("CloseAllContracts").'</a>';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
@ -1277,7 +1363,7 @@ else
|
||||
// - Droit de supprimer
|
||||
if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?id='.$id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
@ -1296,7 +1382,7 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -24,60 +25,39 @@
|
||||
|
||||
require ("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php');
|
||||
if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
|
||||
$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:"";
|
||||
|
||||
if (!$user->rights->contrat->lire)
|
||||
accessforbidden();
|
||||
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("contracts");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
|
||||
// Security check
|
||||
$id = isset($_GET["id"])?$_GET["id"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contrat',$id,'');
|
||||
$result=restrictedArea($user,'contrat',$id);
|
||||
|
||||
|
||||
$contrat = new Contrat($db);
|
||||
$contrat->fetch($_GET["id"]);
|
||||
$object = new Contrat($db);
|
||||
$object->fetch($id,$ref);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
if ($_POST["action"] == 'update_public' && $user->rights->contrat->creer)
|
||||
if ($action == 'setnote_public' && $user->rights->contrat->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$contrat->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$contrat->error.'</div>';
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'update' && $user->rights->contrat->creer)
|
||||
else if ($action == 'setnote' && $user->rights->contrat->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$contrat->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$contrat->error.'</div>';
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -90,14 +70,13 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($_GET["id"])
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($contrat->societe->id);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = contract_prepare_head($contrat);
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
$hselected = 2;
|
||||
|
||||
@ -107,82 +86,34 @@ if ($_GET["id"])
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="5">'.$contrat->ref.'</td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="5">'.$object->ref.'</td></tr>';
|
||||
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
||||
if ($contrat->societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$contrat->societe->remise_client);
|
||||
if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$contrat->societe->getAvailableDiscounts();
|
||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
// Note publique
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?id='.$contrat->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update_public">';
|
||||
print '<textarea name="note_public" cols="80" rows="'.ROWS_8.'">'.$contrat->note_public."</textarea><br>";
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($contrat->note_public?nl2br($contrat->note_public):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
print '<br>';
|
||||
|
||||
// Note priv<69>e
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?id='.$contrat->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<textarea name="note" cols="80" rows="'.ROWS_8.'">'.$contrat->note."</textarea><br>";
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($contrat->note?nl2br($contrat->note):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '</div>';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->contrat->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"note.php?id=".$contrat->id."&action=edit\">".$langs->trans('Modify')."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -53,15 +53,20 @@ if(! empty($id) && ! empty($element) && ! empty($htmlelement) && ! empty($type))
|
||||
|
||||
// For compatibility
|
||||
if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; }
|
||||
else if ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; }
|
||||
else if ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; }
|
||||
else if ($element == 'contract') { $classpath = $subelement = 'contrat'; }
|
||||
else if ($element == 'shipping') { $classpath = $subelement = 'expedition'; }
|
||||
else if ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; }
|
||||
else if ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; }
|
||||
else if ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; }
|
||||
else if ($element == 'contract') { $classpath = $subelement = 'contrat'; }
|
||||
else if ($element == 'shipping') { $classpath = $subelement = 'expedition'; }
|
||||
else if ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; }
|
||||
else if ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; }
|
||||
else if ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; }
|
||||
|
||||
dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php');
|
||||
|
||||
$classname = ucfirst($subelement);
|
||||
if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; }
|
||||
else if ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; }
|
||||
else $classname = ucfirst($subelement);
|
||||
|
||||
$object = new $classname($db);
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
@ -280,6 +280,15 @@ class Form
|
||||
if (! empty($tmp[2])) $savemethod=$tmp[2];
|
||||
if (! empty($tmp[3])) $button_only=true;
|
||||
}
|
||||
else if (preg_match('/^textarea/',$inputType))
|
||||
{
|
||||
$tmp=explode(':',$inputType);
|
||||
$inputType=$tmp[0];
|
||||
if (! empty($tmp[1])) $rows=$tmp[1];
|
||||
if (! empty($tmp[2])) $cols=$tmp[2];
|
||||
|
||||
$out.= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
|
||||
}
|
||||
else if (preg_match('/^ckeditor/',$inputType))
|
||||
{
|
||||
$tmp=explode(':',$inputType);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
|
||||
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -38,22 +38,28 @@ function contract_prepare_head($object)
|
||||
$head[$h][1] = $langs->trans("ContractCard");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Marc Barilley <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
|
||||
@ -39,22 +40,28 @@ function facturefourn_prepare_head($object)
|
||||
$head[$h][1] = $langs->trans('CardBill');
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/contact.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/contact.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_invoice');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id;
|
||||
/*$filesdir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($fac->id,2).$fac->id;
|
||||
@ -99,22 +106,28 @@ function ordersupplier_prepare_head($object)
|
||||
$head[$h][2] = 'dispatch';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$object->id;
|
||||
/*$filesdir = $conf->fournisseur->dir_output . "/commande/" . dol_sanitizeFileName($commande->ref);
|
||||
|
||||
@ -16,9 +16,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
$module = $object->element;
|
||||
if ($module == 'propal') $module = 'propale';
|
||||
else if ($module == 'fichinter') { $module = 'ficheinter'; }
|
||||
$module = $object->element;
|
||||
$permission=(isset($permission)?$permission:$user->rights->$module->creer); // If already defined by caller page
|
||||
|
||||
// Special cases
|
||||
if ($module == 'propal') { $permission=$user->rights->propale->creer; }
|
||||
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; }
|
||||
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; }
|
||||
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; }
|
||||
|
||||
$companystatic=new Societe($db);
|
||||
$contactstatic=new Contact($db);
|
||||
@ -29,7 +34,7 @@ $userstatic=new User($db);
|
||||
<!-- BEGIN PHP TEMPLATE CONTACTS -->
|
||||
<table class="noborder allwidth">
|
||||
|
||||
<?php if ($user->rights->$module->creer) { ?>
|
||||
<?php if ($permission) { ?>
|
||||
<tr class="liste_titre">
|
||||
<td><?php echo $langs->trans("Source"); ?></td>
|
||||
<td><?php echo $langs->trans("Company"); ?></td>
|
||||
@ -155,7 +160,7 @@ $userstatic=new User($db);
|
||||
<?php if ($object->statut >= 0) echo '</a>'; ?>
|
||||
</td>
|
||||
<td align="center" nowrap="nowrap" colspan="2">
|
||||
<?php if ($user->rights->$module->creer) { ?>
|
||||
<?php if ($permission) { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deletecontact&lineid='.$tab[$i]['rowid']; ?>"><?php echo img_delete(); ?></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
@ -32,7 +32,7 @@ elseif ($module == 'project_task') { $note_private = 'note_private'; }
|
||||
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; }
|
||||
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; }
|
||||
|
||||
if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200:1:12:100';
|
||||
if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100';
|
||||
else $typeofdata='textarea:12:100';
|
||||
?>
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.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
|
||||
@ -68,6 +68,8 @@ class CommandeFournisseur extends Commande
|
||||
var $cond_reglement_code;
|
||||
var $mode_reglement_id;
|
||||
var $mode_reglement_code;
|
||||
|
||||
var $extraparams=array();
|
||||
|
||||
|
||||
/**
|
||||
@ -111,7 +113,7 @@ class CommandeFournisseur extends Commande
|
||||
$sql = "SELECT c.rowid, c.ref, c.date_creation, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
|
||||
$sql.= " c.localtax1, c.localtax2, ";
|
||||
$sql.= " c.date_commande as date_commande, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,";
|
||||
$sql.= " c.note as note_private, c.note_public, c.model_pdf,";
|
||||
$sql.= " c.note as note_private, c.note_public, c.model_pdf, c.extraparams,";
|
||||
$sql.= " cm.libelle as methode_commande,";
|
||||
$sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
|
||||
$sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle";
|
||||
@ -135,37 +137,39 @@ class CommandeFournisseur extends Commande
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->fourn_id = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->tva;
|
||||
$this->total_localtax1 = $obj->localtax1;
|
||||
$this->total_localtax2 = $obj->localtax2;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->date_commande = $this->db->jdate($obj->date_commande); // date a laquelle la commande a ete transmise
|
||||
$this->date = $this->db->jdate($obj->date_creation);
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->methode_commande_id = $obj->fk_methode_commande;
|
||||
$this->methode_commande = $obj->methode_commande;
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->fourn_id = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->tva;
|
||||
$this->total_localtax1 = $obj->localtax1;
|
||||
$this->total_localtax2 = $obj->localtax2;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->date_commande = $this->db->jdate($obj->date_commande); // date a laquelle la commande a ete transmise
|
||||
$this->date = $this->db->jdate($obj->date_creation);
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->methode_commande_id = $obj->fk_methode_commande;
|
||||
$this->methode_commande = $obj->methode_commande;
|
||||
|
||||
$this->source = $obj->source;
|
||||
$this->source = $obj->source;
|
||||
//$this->facturee = $obj->facture;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->cond_reglement_id = $obj->fk_cond_reglement;
|
||||
$this->cond_reglement_code = $obj->cond_reglement_code;
|
||||
$this->cond_reglement = $obj->cond_reglement_libelle;
|
||||
$this->cond_reglement_doc = $obj->cond_reglement_libelle;
|
||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||
$this->mode_reglement_code = $obj->mode_reglement_code;
|
||||
$this->mode_reglement = $obj->mode_reglement_libelle;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->cond_reglement_id = $obj->fk_cond_reglement;
|
||||
$this->cond_reglement_code = $obj->cond_reglement_code;
|
||||
$this->cond_reglement = $obj->cond_reglement_libelle;
|
||||
$this->cond_reglement_doc = $obj->cond_reglement_libelle;
|
||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||
$this->mode_reglement_code = $obj->mode_reglement_code;
|
||||
$this->mode_reglement = $obj->mode_reglement_libelle;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
$this->extraparams = (array) dol_json_decode($obj->extraparams, true);
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -71,12 +71,15 @@ class FactureFournisseur extends Facture
|
||||
var $total_localtax1;
|
||||
var $total_localtax2;
|
||||
var $total_ttc;
|
||||
var $note;
|
||||
var $note; // deprecated
|
||||
var $note_private;
|
||||
var $note_public;
|
||||
var $propalid;
|
||||
|
||||
var $lines;
|
||||
var $fournisseur;
|
||||
|
||||
var $extraparams=array();
|
||||
|
||||
|
||||
/**
|
||||
@ -287,6 +290,7 @@ class FactureFournisseur extends Facture
|
||||
$sql.= " t.note_public,";
|
||||
$sql.= " t.model_pdf,";
|
||||
$sql.= " t.import_key,";
|
||||
$sql.= " t.extraparams,";
|
||||
$sql.= ' s.nom as socnom, s.rowid as socid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t,'.MAIN_DB_PREFIX.'societe as s';
|
||||
if ($id) $sql.= " WHERE t.rowid=".$id;
|
||||
@ -301,46 +305,48 @@ class FactureFournisseur extends Facture
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->ref_supplier = $obj->facnumber;
|
||||
$this->facnumber = $obj->facnumber;
|
||||
$this->entity = $obj->entity;
|
||||
$this->type = empty($obj->type)?0:$obj->type;
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->date = $this->db->jdate($obj->datef);
|
||||
$this->datep = $this->db->jdate($obj->datef);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->label = $obj->libelle;
|
||||
$this->paye = $obj->paye;
|
||||
$this->amount = $obj->amount;
|
||||
$this->remise = $obj->remise;
|
||||
$this->close_code = $obj->close_code;
|
||||
$this->close_note = $obj->close_note;
|
||||
$this->tva = $obj->tva;
|
||||
$this->total_localtax1 = $obj->localtax1;
|
||||
$this->total_localtax2 = $obj->localtax2;
|
||||
$this->total = $obj->total;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->fk_statut = $obj->fk_statut;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->author = $obj->fk_user_author;
|
||||
$this->fk_user_valid = $obj->fk_user_valid;
|
||||
$this->fk_facture_source = $obj->fk_facture_source;
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
$this->fk_cond_reglement = $obj->fk_cond_reglement;
|
||||
$this->date_echeance = $this->db->jdate($obj->date_lim_reglement);
|
||||
$this->note = $obj->note_private;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->import_key = $obj->import_key;
|
||||
$this->ref_supplier = $obj->facnumber;
|
||||
$this->facnumber = $obj->facnumber;
|
||||
$this->entity = $obj->entity;
|
||||
$this->type = empty($obj->type)?0:$obj->type;
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->date = $this->db->jdate($obj->datef);
|
||||
$this->datep = $this->db->jdate($obj->datef);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->label = $obj->libelle;
|
||||
$this->paye = $obj->paye;
|
||||
$this->amount = $obj->amount;
|
||||
$this->remise = $obj->remise;
|
||||
$this->close_code = $obj->close_code;
|
||||
$this->close_note = $obj->close_note;
|
||||
$this->tva = $obj->tva;
|
||||
$this->total_localtax1 = $obj->localtax1;
|
||||
$this->total_localtax2 = $obj->localtax2;
|
||||
$this->total = $obj->total;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->fk_statut = $obj->fk_statut;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->author = $obj->fk_user_author;
|
||||
$this->fk_user_valid = $obj->fk_user_valid;
|
||||
$this->fk_facture_source = $obj->fk_facture_source;
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
$this->fk_cond_reglement = $obj->fk_cond_reglement;
|
||||
$this->date_echeance = $this->db->jdate($obj->date_lim_reglement);
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
$this->extraparams = (array) dol_json_decode($obj->extraparams, true);
|
||||
|
||||
$this->socid = $obj->socid;
|
||||
$this->socnom = $obj->socnom;
|
||||
|
||||
@ -78,7 +78,7 @@ if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer)
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
if ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
@ -91,7 +91,7 @@ if ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer)
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
if ($action == 'deleteline' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'deletecontact' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
@ -162,188 +162,11 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
|
||||
// TODO All contact.php pages use this huge part of code. Use a function instead.
|
||||
|
||||
/*
|
||||
* Lignes de contacts
|
||||
*/
|
||||
echo '<br><table class="noborder" width="100%">';
|
||||
|
||||
/*
|
||||
* Ajouter une ligne de contact
|
||||
* Non affiche en mode modification de ligne
|
||||
*/
|
||||
if ($action != 'editline' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||
print '<td colspan="3"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var = false;
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addcontact">';
|
||||
print '<input type="hidden" name="source" value="internal">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
// Ligne ajout pour contact interne
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td nowrap="0">';
|
||||
print img_object('','user').' '.$langs->trans("Users");
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
//$userAlreadySelected = $object->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||
$form->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formcompany->selectTypeContact($object, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addcontact">';
|
||||
print '<input type="hidden" name="source" value="external">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
// Ligne ajout pour contact externe
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$soc->id;
|
||||
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany');
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
$nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid');
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formcompany->selectTypeContact($object, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="disabled"';
|
||||
print '></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</form>";
|
||||
|
||||
print '<tr><td colspan="6"> </td></tr>';
|
||||
}
|
||||
|
||||
// List of linked contacts
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$var = true;
|
||||
|
||||
foreach(array('internal','external') as $source)
|
||||
{
|
||||
$tab = $object->liste_contact(-1,$source);
|
||||
$num=count($tab);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
print '<tr '.$bc[$var].' valign="top">';
|
||||
|
||||
// Source
|
||||
print '<td align="left">';
|
||||
if ($tab[$i]['source']=='internal') print $langs->trans("User");
|
||||
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
|
||||
print '</td>';
|
||||
|
||||
// Societe
|
||||
print '<td align="left">';
|
||||
if ($tab[$i]['socid'] > 0)
|
||||
{
|
||||
$companystatic->fetch($tab[$i]['socid']);
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
else if ($tab[$i]['socid'] < 0)
|
||||
{
|
||||
print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
}
|
||||
else if (! $tab[$i]['socid'])
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Contact
|
||||
print '<td>';
|
||||
if ($tab[$i]['source']=='internal')
|
||||
{
|
||||
$userstatic->id=$tab[$i]['id'];
|
||||
$userstatic->lastname=$tab[$i]['lastname'];
|
||||
$userstatic->firstname=$tab[$i]['firstname'];
|
||||
print $userstatic->getNomUrl(1);
|
||||
}
|
||||
if ($tab[$i]['source']=='external')
|
||||
{
|
||||
$contactstatic->id=$tab[$i]['id'];
|
||||
$contactstatic->lastname=$tab[$i]['lastname'];
|
||||
$contactstatic->firstname=$tab[$i]['firstname'];
|
||||
print $contactstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Type de contact
|
||||
print '<td>'.$tab[$i]['libelle'].'</td>';
|
||||
|
||||
// Statut
|
||||
print '<td align="center">';
|
||||
// Activation desativation du contact
|
||||
if ($object->statut >= 0) print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||
if ($object->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon update et delete
|
||||
print '<td align="center" nowrap="nowrap">';
|
||||
if ($object->statut < 5 && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -352,8 +175,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
?>
|
||||
@ -33,9 +33,9 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formorder.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/modules/supplier_order/modules_commandefournisseur.php');
|
||||
require_once DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.product.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/fourn.lib.php";
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||
if ($conf->produit->enabled) require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
||||
|
||||
$langs->load('orders');
|
||||
@ -81,26 +81,40 @@ if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer)
|
||||
}
|
||||
|
||||
// mode de reglement
|
||||
if ($action == 'setmode' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||
}
|
||||
|
||||
// Set project
|
||||
if ($action == 'classin')
|
||||
else if ($action == 'classin' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setProject($projectid);
|
||||
}
|
||||
|
||||
if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->set_remise($user, $_POST['remise_percent']);
|
||||
}
|
||||
|
||||
if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
|
||||
else if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
|
||||
{
|
||||
$order = new CommandeFournisseur($db);
|
||||
$result = $order->fetch($id);
|
||||
@ -127,7 +141,7 @@ if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
|
||||
/*
|
||||
* Add a line into product
|
||||
*/
|
||||
if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
if (($_POST['qty'] || $_POST['pqty']) && (($_POST['pu'] && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprodfournprice']))
|
||||
{
|
||||
@ -258,7 +272,7 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
||||
/*
|
||||
* Mise a jour d'une ligne dans la commande
|
||||
*/
|
||||
if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer && $_POST['save'] == $langs->trans('Save'))
|
||||
else if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer && $_POST['save'] == $langs->trans('Save'))
|
||||
{
|
||||
$product=new Product($db);
|
||||
if ($_POST["elrowid"])
|
||||
@ -307,7 +321,7 @@ if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer && $
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
@ -339,7 +353,7 @@ if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider)
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider)
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
@ -371,7 +385,7 @@ if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseu
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver)
|
||||
else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver)
|
||||
{
|
||||
$idwarehouse=GETPOST('idwarehouse');
|
||||
|
||||
@ -404,7 +418,7 @@ if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fourniss
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver)
|
||||
else if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->refuse($user);
|
||||
@ -419,7 +433,7 @@ if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->fournisse
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander)
|
||||
else if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
|
||||
@ -435,7 +449,7 @@ if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournis
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->commande->supprimer)
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->commande->supprimer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->delete($user);
|
||||
@ -451,7 +465,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisse
|
||||
}
|
||||
|
||||
// Receive
|
||||
if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner)
|
||||
else if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner)
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
@ -481,7 +495,7 @@ if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander)
|
||||
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->cancel($user);
|
||||
@ -497,8 +511,7 @@ if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisse
|
||||
}
|
||||
|
||||
// Line ordering
|
||||
|
||||
if ($action == 'up' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'up' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->line_up($_GET['rowid']);
|
||||
@ -513,8 +526,7 @@ if ($action == 'up' && $user->rights->fournisseur->commande->creer)
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'down' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'down' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->line_down($_GET['rowid']);
|
||||
@ -530,8 +542,7 @@ if ($action == 'down' && $user->rights->fournisseur->commande->creer)
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'builddoc') // En get ou en post
|
||||
else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post
|
||||
{
|
||||
// Build document
|
||||
|
||||
@ -562,7 +573,7 @@ if ($action == 'builddoc') // En get ou en post
|
||||
}
|
||||
|
||||
// Delete file in doc form
|
||||
if ($action=='remove_file')
|
||||
else if ($action == 'remove_file' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
@ -578,7 +589,7 @@ if ($action=='remove_file')
|
||||
/*
|
||||
* Create an order
|
||||
*/
|
||||
if ($action == 'create')
|
||||
else if ($action == 'create' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
@ -801,6 +812,66 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -1082,6 +1153,24 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
print "</table><br>";
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
dol_htmloutput_errors('',$errors);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -34,55 +34,55 @@ $langs->load("bills");
|
||||
$langs->load('other');
|
||||
$langs->load("companies");
|
||||
|
||||
$facid = isset($_GET["facid"])?$_GET["facid"]:'';
|
||||
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('facid','int'));
|
||||
$ref = GETPOST('ref','alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture');
|
||||
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
|
||||
|
||||
$object = new FactureFournisseur($db);
|
||||
|
||||
|
||||
/*
|
||||
* Ajout d'un nouveau contact
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'addcontact' && $user->rights->fournisseur->facture->creer)
|
||||
if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$result = 0;
|
||||
$facture = new FactureFournisseur($db);
|
||||
$result = $facture->fetch($_GET["facid"]);
|
||||
|
||||
if ($result > 0 && $_GET["facid"] > 0)
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$result = $facture->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: contact.php?facid=".$facture->id);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($facture->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$facture->error.'</div>';
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
if ($_GET["action"] == 'swapstatut' && $user->rights->fournisseur->facture->creer)
|
||||
else if ($action == 'swapstatut' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$facture = new FactureFournisseur($db);
|
||||
if ($facture->fetch(GETPOST('facid','int')))
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$facture->swapContactStatus(GETPOST('ligne'));
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -91,15 +91,14 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->fournisseur->facture->cree
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
if ($_GET["action"] == 'deleteline' && $user->rights->fournisseur->facture->creer)
|
||||
else if ($action == 'deletecontact' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$facture = new FactureFournisseur($db);
|
||||
$facture->fetch($_GET["facid"]);
|
||||
$result = $facture->delete_contact($_GET["lineid"]);
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: contact.php?facid=".$facture->id);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
@ -127,15 +126,13 @@ $userstatic=new User($db);
|
||||
/* *************************************************************************** */
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
$id = $_GET["facid"];
|
||||
if ($id > 0)
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$facture = new FactureFournisseur($db);
|
||||
if ($facture->fetch($_GET['facid'], $user->societe_id) > 0)
|
||||
if ($object->fetch($id, $ref) > 0)
|
||||
{
|
||||
$facture->fetch_thirdparty();
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = facturefourn_prepare_head($facture);
|
||||
$head = facturefourn_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), 0, 'bill');
|
||||
|
||||
@ -146,200 +143,25 @@ if ($id > 0)
|
||||
|
||||
// Reference du facture
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($facture,'facid','',1,'rowid','ref',$morehtmlref);
|
||||
print $form->showrefnav($object,'facid','',1,'rowid','ref',$morehtmlref);
|
||||
print "</td></tr>";
|
||||
|
||||
// Ref supplier
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$facture->ref_supplier.'</td>';
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Third party
|
||||
print "<tr><td>".$langs->trans("Supplier")."</td>";
|
||||
print '<td colspan="3">'.$facture->client->getNomUrl(1,'compta').'</td></tr>';
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1,'compta').'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Lignes de contacts
|
||||
*/
|
||||
echo '<br><table class="noborder" width="100%">';
|
||||
|
||||
/*
|
||||
* Ajouter une ligne de contact
|
||||
* Non affiche en mode modification de ligne
|
||||
*/
|
||||
if ($_GET["action"] != 'editline' && $user->rights->facture->creer)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||
print '<td colspan="3"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var = false;
|
||||
|
||||
print '<form action="contact.php?facid='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addcontact">';
|
||||
print '<input type="hidden" name="source" value="internal">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
// Ligne ajout pour contact interne
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
print img_object('','user').' '.$langs->trans("Users");
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
print $mysoc->name;
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
//$userAlreadySelected = $facture->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
|
||||
$form->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formcompany->selectTypeContact($facture, '', 'type','internal');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<form action="contact.php?facid='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addcontact">';
|
||||
print '<input type="hidden" name="source" value="external">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
// Ligne ajout pour contact externe
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$facture->client->id;
|
||||
$selectedCompany = $formcompany->selectCompaniesForNewContact($facture, 'facid', $selectedCompany, $htmlname = 'newcompany');
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="1">';
|
||||
$nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid');
|
||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formcompany->selectTypeContact($facture, '', 'type','external');
|
||||
print '</td>';
|
||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||
if (! $nbofcontacts) print ' disabled="disabled"';
|
||||
print '></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</form>";
|
||||
|
||||
print '<tr><td colspan="6"> </td></tr>';
|
||||
}
|
||||
|
||||
// List of linked contacts
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Source").'</td>';
|
||||
print '<td>'.$langs->trans("Company").'</td>';
|
||||
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$var = true;
|
||||
|
||||
foreach(array('internal','external') as $source)
|
||||
{
|
||||
$tab = $facture->liste_contact(-1,$source);
|
||||
$num=count($tab);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
print '<tr '.$bc[$var].' valign="top">';
|
||||
|
||||
// Source
|
||||
print '<td align="left">';
|
||||
if ($tab[$i]['source']=='internal') print $langs->trans("User");
|
||||
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
|
||||
print '</td>';
|
||||
|
||||
// Societe
|
||||
print '<td align="left">';
|
||||
if ($tab[$i]['socid'] > 0)
|
||||
{
|
||||
$companystatic->fetch($tab[$i]['socid']);
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
if ($tab[$i]['socid'] < 0)
|
||||
{
|
||||
print $mysoc->name;
|
||||
}
|
||||
if (! $tab[$i]['socid'])
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Contact
|
||||
print '<td>';
|
||||
if ($tab[$i]['source']=='internal')
|
||||
{
|
||||
$userstatic->id=$tab[$i]['id'];
|
||||
$userstatic->lastname=$tab[$i]['lastname'];
|
||||
$userstatic->firstname=$tab[$i]['firstname'];
|
||||
print $userstatic->getNomUrl(1);
|
||||
}
|
||||
if ($tab[$i]['source']=='external')
|
||||
{
|
||||
$contactstatic->id=$tab[$i]['id'];
|
||||
$contactstatic->lastname=$tab[$i]['lastname'];
|
||||
$contactstatic->firstname=$tab[$i]['firstname'];
|
||||
print $contactstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Type de contact
|
||||
print '<td>'.$tab[$i]['libelle'].'</td>';
|
||||
|
||||
// Statut
|
||||
print '<td align="center">';
|
||||
// Activation desativation du contact
|
||||
if ($facture->statut >= 0) print '<a href="contact.php?facid='.$facture->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||
if ($facture->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon update et delete (statut contrat 0=brouillon,1=valid<69>,2=ferm<72>)
|
||||
print '<td align="center" nowrap>';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
print ' ';
|
||||
print '<a href="contact.php?facid='.$facture->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -347,7 +169,7 @@ if ($id > 0)
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
@ -184,6 +184,18 @@ elseif ($action == 'setdate_lim_reglement' && $user->rights->fournisseur->factur
|
||||
$result=$object->update($user);
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
elseif ($action == 'setnote_public' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
elseif ($action == 'setnote' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
// Delete payment
|
||||
elseif($action == 'deletepaiement')
|
||||
@ -819,6 +831,66 @@ elseif ($action == 'remove_file')
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -1406,7 +1478,26 @@ else
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table><br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$colwidth=20;
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -31,9 +31,9 @@ require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
|
||||
$langs->load('bills');
|
||||
$langs->load("companies");
|
||||
|
||||
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
|
||||
$ref = GETPOST('ref');
|
||||
$action = GETPOST('action');
|
||||
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('facid','int'));
|
||||
$ref = GETPOST('ref','alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
|
||||
@ -442,5 +442,9 @@ ALTER TABLE llx_commande ADD COLUMN extraparams varchar(255) AFTER import_key;
|
||||
ALTER TABLE llx_facture ADD COLUMN extraparams varchar(255) AFTER import_key;
|
||||
ALTER TABLE llx_fichinter ADD COLUMN extraparams varchar(255) AFTER model_pdf;
|
||||
ALTER TABLE llx_deplacement ADD COLUMN extraparams varchar(255) AFTER note_public;
|
||||
ALTER TABLE llx_contrat ADD COLUMN import_key varchar(14) AFTER note_public;
|
||||
ALTER TABLE llx_contrat ADD COLUMN extraparams varchar(255) AFTER import_key;
|
||||
ALTER TABLE llx_commande_fournisseur ADD COLUMN extraparams varchar(255) AFTER import_key;
|
||||
ALTER TABLE llx_facture_fourn ADD COLUMN extraparams varchar(255) AFTER import_key;
|
||||
|
||||
ALTER TABLE llx_boxes ADD COLUMN maxline integer NULL;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
-- Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
--
|
||||
-- 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,49 +21,43 @@
|
||||
|
||||
create table llx_commande_fournisseur
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
|
||||
ref varchar(30) NOT NULL, -- order number
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
ref varchar(30) NOT NULL, -- order number
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
|
||||
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
|
||||
ref_supplier varchar(30),
|
||||
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
|
||||
ref_supplier varchar(30),
|
||||
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande
|
||||
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
date_cloture datetime, -- date de cloture
|
||||
date_commande date, -- date de la commande
|
||||
fk_user_author integer, -- createur de la commande
|
||||
fk_user_valid integer, -- valideur de la commande
|
||||
fk_user_cloture integer, -- auteur cloture
|
||||
source smallint NOT NULL,
|
||||
fk_statut smallint default 0,
|
||||
amount_ht real default 0,
|
||||
remise_percent real default 0,
|
||||
remise real default 0,
|
||||
tva double(24,8) default 0,
|
||||
localtax1 double(24,8) default 0,
|
||||
localtax2 double(24,8) default 0,
|
||||
total_ht double(24,8) default 0,
|
||||
total_ttc double(24,8) default 0,
|
||||
note text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
date_cloture datetime, -- date de cloture
|
||||
date_commande date, -- date de la commande
|
||||
fk_user_author integer, -- createur de la commande
|
||||
fk_user_valid integer, -- valideur de la commande
|
||||
fk_user_cloture integer, -- auteur cloture
|
||||
source smallint NOT NULL,
|
||||
fk_statut smallint default 0,
|
||||
amount_ht real default 0,
|
||||
remise_percent real default 0,
|
||||
remise real default 0,
|
||||
tva double(24,8) default 0,
|
||||
localtax1 double(24,8) default 0,
|
||||
localtax2 double(24,8) default 0,
|
||||
total_ht double(24,8) default 0,
|
||||
total_ttc double(24,8) default 0,
|
||||
note text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
|
||||
fk_cond_reglement integer, -- condition de reglement
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
fk_methode_commande integer default 0, -- should be named fk_input_method
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for stock other parameters with json format
|
||||
|
||||
fk_cond_reglement integer, -- condition de reglement
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
fk_methode_commande integer default 0, -- should be named fk_input_method
|
||||
import_key varchar(14)
|
||||
)ENGINE=innodb;
|
||||
|
||||
--
|
||||
-- List of codes for the field entity
|
||||
--
|
||||
-- 1 : first company order
|
||||
-- 2 : second company order
|
||||
-- 3 : etc...
|
||||
--
|
||||
@ -1,7 +1,7 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
-- Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
--
|
||||
-- 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,25 +20,27 @@
|
||||
|
||||
create table llx_contrat
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(30), -- reference de contrat
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
tms timestamp,
|
||||
datec datetime, -- date de creation de l enregistrement
|
||||
date_contrat datetime,
|
||||
statut smallint DEFAULT 0,
|
||||
mise_en_service datetime,
|
||||
fin_validite datetime,
|
||||
date_cloture datetime,
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer,
|
||||
fk_commercial_signature integer NOT NULL, -- obsolete
|
||||
fk_commercial_suivi integer NOT NULL, -- obsolete
|
||||
fk_user_author integer NOT NULL default 0,
|
||||
fk_user_mise_en_service integer,
|
||||
fk_user_cloture integer,
|
||||
note text,
|
||||
note_public text
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(30), -- reference de contrat
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
tms timestamp,
|
||||
datec datetime, -- date de creation de l enregistrement
|
||||
date_contrat datetime,
|
||||
statut smallint DEFAULT 0,
|
||||
mise_en_service datetime,
|
||||
fin_validite datetime,
|
||||
date_cloture datetime,
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer,
|
||||
fk_commercial_signature integer NOT NULL, -- obsolete
|
||||
fk_commercial_suivi integer NOT NULL, -- obsolete
|
||||
fk_user_author integer NOT NULL default 0,
|
||||
fk_user_mise_en_service integer,
|
||||
fk_user_cloture integer,
|
||||
note text,
|
||||
note_public text,
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for stock other parameters with json format
|
||||
|
||||
)ENGINE=innodb;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- ===========================================================================
|
||||
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2007-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
-- Copyright (C) 2007-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
@ -21,49 +21,50 @@
|
||||
|
||||
create table llx_facture_fourn
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
|
||||
facnumber varchar(50) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
facnumber varchar(50) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
|
||||
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
|
||||
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
|
||||
|
||||
type smallint DEFAULT 0 NOT NULL,
|
||||
fk_soc integer NOT NULL,
|
||||
type smallint DEFAULT 0 NOT NULL,
|
||||
fk_soc integer NOT NULL,
|
||||
|
||||
datec datetime, -- date de creation de la facture
|
||||
datef date, -- date de la facture
|
||||
tms timestamp, -- date creation/modification
|
||||
libelle varchar(255),
|
||||
paye smallint DEFAULT 0 NOT NULL,
|
||||
amount double(24,8) DEFAULT 0 NOT NULL,
|
||||
remise double(24,8) DEFAULT 0,
|
||||
datec datetime, -- date de creation de la facture
|
||||
datef date, -- date de la facture
|
||||
tms timestamp, -- date creation/modification
|
||||
libelle varchar(255),
|
||||
paye smallint DEFAULT 0 NOT NULL,
|
||||
amount double(24,8) DEFAULT 0 NOT NULL,
|
||||
remise double(24,8) DEFAULT 0,
|
||||
|
||||
close_code varchar(16), -- Code motif cloture sans paiement complet
|
||||
close_note varchar(128), -- Commentaire cloture sans paiement complet
|
||||
close_code varchar(16), -- Code motif cloture sans paiement complet
|
||||
close_note varchar(128), -- Commentaire cloture sans paiement complet
|
||||
|
||||
tva double(24,8) DEFAULT 0,
|
||||
localtax1 double(24,8) DEFAULT 0,
|
||||
localtax2 double(24,8) DEFAULT 0,
|
||||
total double(24,8) DEFAULT 0,
|
||||
total_ht double(24,8) DEFAULT 0,
|
||||
total_tva double(24,8) DEFAULT 0,
|
||||
total_ttc double(24,8) DEFAULT 0,
|
||||
tva double(24,8) DEFAULT 0,
|
||||
localtax1 double(24,8) DEFAULT 0,
|
||||
localtax2 double(24,8) DEFAULT 0,
|
||||
total double(24,8) DEFAULT 0,
|
||||
total_ht double(24,8) DEFAULT 0,
|
||||
total_tva double(24,8) DEFAULT 0,
|
||||
total_ttc double(24,8) DEFAULT 0,
|
||||
|
||||
fk_statut smallint DEFAULT 0 NOT NULL,
|
||||
fk_statut smallint DEFAULT 0 NOT NULL,
|
||||
|
||||
fk_user_author integer, -- createur de la facture
|
||||
fk_user_valid integer, -- valideur de la facture
|
||||
fk_user_author integer, -- createur de la facture
|
||||
fk_user_valid integer, -- valideur de la facture
|
||||
|
||||
fk_facture_source integer, -- facture origine si facture avoir
|
||||
fk_projet integer, -- projet auquel est associ<EFBFBD>e la facture
|
||||
fk_facture_source integer, -- facture origine si facture avoir
|
||||
fk_projet integer, -- projet auquel est associee la facture
|
||||
|
||||
fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...)
|
||||
date_lim_reglement date, -- date limite de reglement
|
||||
fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...)
|
||||
date_lim_reglement date, -- date limite de reglement
|
||||
|
||||
note text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
import_key varchar(14)
|
||||
note text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for stock other parameters with json format
|
||||
|
||||
)ENGINE=innodb;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user