New: [ task #707 ] Create option ProfIdx are mandatory to validate a

invoice
This commit is contained in:
simnandez
2013-02-21 11:03:14 +01:00
parent c03f346c6d
commit 4cb6072f03
7 changed files with 60 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ For users:
- New: total per vat rate are available as tags for ODT templates.
- New: Add more types for extra parameters (lists, phone, emails, checkbox, prices)
- New: Some part of interface use more CSS3 (ie: agenda)
- New: [ task #707 ] Create option ProfIdx are mandatory to validate a invoice
For developers:
- System of menu managers has been rewritten to reduce code to do same things.

View File

@@ -366,6 +366,22 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
$object->fetch_thirdparty();
// Check parameters
// Check for mandatory prof id
for ($i = 1; $i < 5; $i++)
{
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_INVOICE_MANDATORY';
if (! $object->thirdparty->idprof.$i && ! empty($conf->global->$idprof_mandatory))
{
if (! $error) $langs->load("errors");
$error++;
setEventMessage($langs->trans('ErrorProdIdIsMandatory',$langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)),'errors');
}
}
//Check for warehouse
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1))
{
if (! $idwarehouse || $idwarehouse == -1)
@@ -375,7 +391,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
$action='';
}
}
if (! $error)
{
$result = $object->validate($user,'',$idwarehouse);

View File

@@ -962,7 +962,8 @@ DocumentModelOdt=Generació des dels documents amb format OpenDocument (Arxiu .O
WatermarkOnDraft=Marca d'aigua en els documents esborrany
CompanyIdProfChecker=Règles sobre els ID professionals
MustBeUnique=Ha de ser únic?
MustBeMandatory=Ha de ser obligatori?
MustBeMandatory=Ha de ser obligatori per a crear tercers?
MustBeInvoiceMandatory=Ha de ser obligatori per a validar factures?
Miscellanous=Miscel·lània
##### Webcal setup #####
WebCalSetup=Configuració d'enllaç amb el calendari webcalendar

View File

@@ -978,7 +978,8 @@ DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT files for
WatermarkOnDraft=Watermark on draft document
CompanyIdProfChecker=Rules ono Professional Ids
MustBeUnique=Must be unique ?
MustBeMandatory=Must be mandatory ?
MustBeMandatory=Must be mandatory to create thirds?
MustBeInvoiceMandatory=Must be mandatory to validate invoices?
Miscellanous=Miscellaneous
##### Webcal setup #####
WebCalSetup=Webcalendar link setup

View File

@@ -964,7 +964,8 @@ DocumentModelOdt=Generación desde los documentos OpenDocument (Archivo .ODT Ope
WatermarkOnDraft=Marca de agua en los documentos borrador
CompanyIdProfChecker=Reglas sobre los ID profesionales
MustBeUnique=¿Debe ser único?
MustBeMandatory=¿Debe ser obligatorio?
MustBeMandatory=¿Debe ser obligatorio para crear terceros?
MustBeInvoiceMandatory=¿Debe ser obligatorio para validar facturas?
Miscellanous=Miscelánea
##### Webcal setup #####
WebCalSetup=Configuración de enlace con el calendario Webcalendar

View File

@@ -975,7 +975,8 @@ DocumentModelOdt=Genération depuis des modèles OpenDocument (Fichier .ODT Open
WatermarkOnDraft=Filigrane sur les documents brouillons
CompanyIdProfChecker=Règles sur les Ids professionnels
MustBeUnique=Doit être unique ?
MustBeMandatory=Doit être obligatoire?
MustBeMandatory=Doit être obligatoire pour creer tiers ?
MustBeInvoiceMandatory=Doit être obligatoire pour valider factures ?
Miscellanous=Divers
##### Webcal setup #####
WebCalSetup= Configuration du lien vers le calendrier Webcalendar

View File

@@ -210,7 +210,7 @@ if ($action == 'setprofid')
}
}
//Activate ProfId
//Activate ProfId mandatory
if ($action == 'setprofidmandatory')
{
$status = GETPOST('status','alpha');
@@ -227,6 +227,22 @@ if ($action == 'setprofidmandatory')
}
}
//Activate ProfId invoice mandatory
if ($action == 'setprofidinvoicemandatory')
{
$status = GETPOST('status','alpha');
$idprof="SOCIETE_IDPROF".$value."_INVOICE_MANDATORY";
if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
/*
* View
@@ -554,6 +570,7 @@ print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center">'.$langs->trans("MustBeUnique").'</td>';
print '<td align="center">'.$langs->trans("MustBeMandatory").'</td>';
print '<td align="center">'.$langs->trans("MustBeInvoiceMandatory").'</td>';
print "</tr>\n";
$profid[0][0]=$langs->trans("ProfId1");
@@ -586,8 +603,10 @@ while ($i < $nbofloop)
$idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE';
$idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY';
$idprof_invoice_mandatory ='SOCIETE_IDPROF'.($i+1).'_INVOICE_MANDATORY';
$verif=(empty($conf->global->$idprof_unique)?false:true);
$mandatory=(empty($conf->global->$idprof_mandatory)?false:true);
$invoice_mandatory=(empty($conf->global->$idprof_invoice_mandatory)?false:true);
if ($verif)
{
@@ -614,6 +633,20 @@ while ($i < $nbofloop)
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
if ($invoice_mandatory)
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.($i+1).'&status=0">';
print img_picto($langs->trans("Activated"),'switch_on');
print '</a></td>';
}
else
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.($i+1).'&status=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
print "</tr>\n";
}
$i++;