Skip to content

Commit

Permalink
[ task #731 ] Uniformize ref generation. Interventions
Browse files Browse the repository at this point in the history
[ task #748 ] Add a link "Dolibarr" into left menu
  • Loading branch information
simnandez committed Mar 10, 2013
1 parent 92c1732 commit f79a26f
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 14 deletions.
24 changes: 22 additions & 2 deletions htdocs/fichinter/class/fichinter.class.php
Expand Up @@ -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
Expand Down Expand Up @@ -156,7 +156,16 @@ function create()
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)
{
Expand Down Expand Up @@ -357,9 +366,20 @@ function setValid($user)
$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;
Expand Down
28 changes: 22 additions & 6 deletions htdocs/fichinter/fiche.php
Expand Up @@ -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
Expand Down Expand Up @@ -917,8 +917,8 @@
$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)
{
Expand All @@ -935,8 +935,7 @@
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>';
Expand Down Expand Up @@ -1053,7 +1052,24 @@
// 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>';
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/ca_ES/interventions.lang
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/interventions.lang
Expand Up @@ -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 :
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/es_ES/interventions.lang
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/fr_FR/interventions.lang
Expand Up @@ -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 :
Expand Down
10 changes: 8 additions & 2 deletions htdocs/main.inc.php
Expand Up @@ -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
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit f79a26f

Please sign in to comment.