[ task #731 ] Uniformize ref generation. Interventions

[ task #748 ] Add a link "Dolibarr" into left menu
This commit is contained in:
simnandez 2013-03-10 13:58:32 +01:00
parent 92c1732b77
commit f79a26fe65
7 changed files with 56 additions and 14 deletions

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 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
@ -156,7 +156,16 @@ class Fichinter extends CommonObject
if ($result)
{
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
if ($this->id)
{
$this->ref='(PROV'.$this->id.')';
$sql = 'UPDATE '.MAIN_DB_PREFIX."fichinter SET ref='".$this->ref."' WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::create sql=".$sql);
$resql=$this->db->query($sql);
if (! $resql) $error++;
}
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
@ -357,9 +366,20 @@ class Fichinter extends CommonObject
$this->db->begin();
$now=dol_now();
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
{
$num = $this->getNextNumRef($soc);
}
else
{
$num = $this->ref;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql.= " SET fk_statut = 1";
$sql.= ", ref = '".$num."'";
$sql.= ", date_valid = ".$this->db->idate($now);
$sql.= ", fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 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
@ -917,8 +917,8 @@ if ($action == 'create')
$obj = $conf->global->FICHEINTER_ADDON;
$obj = "mod_".$obj;
$modFicheinter = new $obj;
$numpr = $modFicheinter->getNextValue($soc, $object);
//$modFicheinter = new $obj;
//$numpr = $modFicheinter->getNextValue($soc, $object);
if ($socid > 0)
{
@ -935,8 +935,7 @@ if ($action == 'create')
print '<input type="hidden" name="action" value="add">';
// Ref
print '<tr><td class="fieldrequired">'.$langs->trans("Ref").'</td>';
print '<td><input name="ref" value="'.$numpr.'"></td></tr>'."\n";
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans("Draft").'</td></tr>';
// Description (must be a textarea and not html must be allowed (used in list view)
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
@ -1053,7 +1052,24 @@ else if ($id > 0 || ! empty($ref))
// Confirmation validation
if ($action == 'validate')
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1);
// on verifie si l'objet est en numerotation provisoire
$ref = substr($object->ref, 1, 4);
if ($ref == 'PROV')
{
$numref = $object->getNextNumRef($soc);
if (empty($numref))
{
$error++;
dol_htmloutput_errors($object->error);
}
}
else
{
$numref = $object->ref;
}
$text=$langs->trans('ConfirmValidateIntervention',$numref);
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1);
if ($ret == 'html') print '<br>';
}

View File

@ -18,7 +18,7 @@ ValidateIntervention=Validar intervenció
ModifyIntervention=Modificar intervenció
DeleteInterventionLine=Eliminar línia d'intervenció
ConfirmDeleteIntervention=Esteu segur de voler eliminar aquesta intervenció?
ConfirmValidateIntervention=Esteu segur de voler validar aquesta intervenció?
ConfirmValidateIntervention=Esteu segur de voler validar aquesta intervenció sota la referència <b>%s</b>?
ConfirmModifyIntervention=Esteu segur de voler modificar aquesta intervenció?
ConfirmDeleteInterventionLine=Esteu segur de voler eliminar aquesta línia?
NameAndSignatureOfInternalContact=Nom i signatura del participant:

View File

@ -18,7 +18,7 @@ ValidateIntervention=Validate intervention
ModifyIntervention=Modify intervention
DeleteInterventionLine=Delete intervention line
ConfirmDeleteIntervention=Are you sure you want to delete this intervention ?
ConfirmValidateIntervention=Are you sure you want to validate this intervention ?
ConfirmValidateIntervention=Are you sure you want to validate this intervention under name <b>%s</b> ?
ConfirmModifyIntervention=Are you sure you want to modify this intervention ?
ConfirmDeleteInterventionLine=Are you sure you want to delete this intervention line ?
NameAndSignatureOfInternalContact=Name and signature of intervening :

View File

@ -18,7 +18,7 @@ ValidateIntervention=Validar intervención
ModifyIntervention=Modificar intervención
DeleteInterventionLine=Eliminar línea de intervención
ConfirmDeleteIntervention=¿Está seguro de querer eliminar esta intervención?
ConfirmValidateIntervention=¿Está seguro de querer validar esta intervención?
ConfirmValidateIntervention=¿Está seguro de querer validar esta intervención bajo la referencia <b>%s</b>?
ConfirmModifyIntervention=¿Está seguro de querer modificar esta intervención?
ConfirmDeleteInterventionLine=¿Está seguro de querer eliminar esta linea?
NameAndSignatureOfInternalContact=Nombre y firma del participante:

View File

@ -18,7 +18,7 @@ ValidateIntervention=Valider intervention
ModifyIntervention=Modifier intervention
DeleteInterventionLine=Supprimer ligne d'intervention
ConfirmDeleteIntervention=Êtes-vous sûr de vouloir effacer cette intervention ?
ConfirmValidateIntervention=Êtes-vous sûr de vouloir valider cette intervention ?
ConfirmValidateIntervention=Êtes-vous sûr de vouloir valider cette intervention sous la référence <b>%s</b> ?
ConfirmModifyIntervention=Êtes-vous sûr de vouloir modifier cette intervention ?
ConfirmDeleteInterventionLine=Êtes-vous sûr de vouloir effacer cette ligne ?
NameAndSignatureOfInternalContact=Nom et signature de l'intervenant :

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2008 Matteli
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -1566,7 +1566,13 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
//Dolibarr version
$doliurl='http://www.dolibarr.org';
print '<div id="blockvmenuhelp" class="blockvmenuhelp"><a class="help" target="_blank" href="'.$doliurl.'">'."Dolibarr ".DOL_VERSION.'</a></div>';
$appli='Dolibarr';
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
$appli.=" ".DOL_VERSION;
print '<div id="blockvmenuhelp" class="blockvmenuhelp"><a class="help" target="_blank" href="'.$doliurl.'">'.$appli.'</a></div>';
print "</div>\n";
print "<!-- End left menu -->\n";