Task #10577: Works with contracts
This commit is contained in:
parent
fc88be4435
commit
422b111ea3
@ -4,7 +4,7 @@
|
||||
* 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 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@ -88,6 +88,55 @@ class Contrat extends CommonObject
|
||||
$this->user_cloture = new User($DB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next contract ref
|
||||
* @param soc objet society
|
||||
* @return string free reference for contract
|
||||
*/
|
||||
function getNextNumRef($soc)
|
||||
{
|
||||
global $db, $langs, $conf;
|
||||
$langs->load("contract");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/contract";
|
||||
|
||||
if (! empty($conf->global->CONTRACT_ADDON))
|
||||
{
|
||||
$file = $conf->global->CONTRACT_ADDON.".php";
|
||||
|
||||
// Chargement de la classe de numerotation
|
||||
$classname = $conf->global->CONTRACT_ADDON;
|
||||
|
||||
$result=include_once($dir.'/'.$file);
|
||||
if ($result)
|
||||
{
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
|
||||
if ( $numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,"Contract::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Activate a contract line
|
||||
* \param user Objet User qui active le contrat
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2009 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 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@ -30,6 +30,7 @@
|
||||
require ("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/contract/modules_contract.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");
|
||||
@ -479,6 +480,12 @@ if ($_GET["action"] == 'create')
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
|
||||
$contract = new Contrat($db);
|
||||
$contract->date_contrat = time();
|
||||
if ($contratid) $result=$contract->fetch($contratid);
|
||||
|
||||
$numct = $contract->getNextNumRef($soc);
|
||||
|
||||
print '<form name="contrat" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
@ -490,7 +497,7 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td><input type="text" maxlength="30" name="ref" size="20" value="'.GETPOST("ref").'"></td></tr>';
|
||||
print '<td><input type="text" maxlength="30" name="ref" size="20" value="'.$numct.'"></td></tr>';
|
||||
|
||||
// Customer
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
||||
|
||||
@ -90,3 +90,4 @@ TypeContact_contrat_internal_SALESREPFOLL= Comercial seguiment del contracte
|
||||
TypeContact_contrat_external_BILLING= Contacte client de facturació del contracte
|
||||
TypeContact_contrat_external_CUSTOMER= Contacte client seguiment del contracte
|
||||
TypeContact_contrat_external_SALESREPSIGN= Contacte client signant del contracte
|
||||
Error_CONTRACT_ADDON_NotDefined=Constant CONTRACT_ADDON no definida
|
||||
@ -91,3 +91,4 @@ TypeContact_contrat_internal_SALESREPFOLL=Sales representative following-up cont
|
||||
TypeContact_contrat_external_BILLING=Billing customer contact
|
||||
TypeContact_contrat_external_CUSTOMER=Follow-up customer contact
|
||||
TypeContact_contrat_external_SALESREPSIGN=Signing contract customer contact
|
||||
Error_CONTRACT_ADDON_NotDefined=Constant CONTRACT_ADDON not defined
|
||||
@ -90,3 +90,4 @@ TypeContact_contrat_internal_SALESREPFOLL= Comercial seguimiento del contrato
|
||||
TypeContact_contrat_external_BILLING= Contacto cliente de facturación del contrato
|
||||
TypeContact_contrat_external_CUSTOMER= Contacto cliente seguimiento del contrato
|
||||
TypeContact_contrat_external_SALESREPSIGN= Contacto cliente firmante del contrato
|
||||
Error_CONTRACT_ADDON_NotDefined=Constante CONTRACT_ADDON no definida
|
||||
@ -90,3 +90,4 @@ TypeContact_contrat_internal_SALESREPFOLL= Comercial seguimiento del contrato
|
||||
TypeContact_contrat_external_BILLING= Contacto cliente de facturación del contrato
|
||||
TypeContact_contrat_external_CUSTOMER= Contacto cliente seguimiento del contrato
|
||||
TypeContact_contrat_external_SALESREPSIGN= Contacto cliente firmante del contrato
|
||||
Error_CONTRACT_ADDON_NotDefined=Constante CONTRACT_ADDON no definida
|
||||
|
||||
@ -91,3 +91,4 @@ TypeContact_contrat_internal_SALESREPFOLL=Commercial suivi du contrat
|
||||
TypeContact_contrat_external_BILLING=Contact client facturation contrat
|
||||
TypeContact_contrat_external_CUSTOMER=Contact client suivi contrat
|
||||
TypeContact_contrat_external_SALESREPSIGN=Contact client signataire contrat
|
||||
Error_CONTRACT_ADDON_NotDefined=Constante CONTRACT_ADDON non définie
|
||||
Loading…
Reference in New Issue
Block a user