From b913d186bdadbe606a0d5b5ea428b9370d733291 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 20 Feb 2013 18:32:14 +0100 Subject: [PATCH 1/4] Qual: Try to delete no more used addpropal.php --- htdocs/comm/addpropal.php | 350 -------------------------------------- 1 file changed, 350 deletions(-) delete mode 100644 htdocs/comm/addpropal.php diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php deleted file mode 100644 index 8c5a07df0c3..00000000000 --- a/htdocs/comm/addpropal.php +++ /dev/null @@ -1,350 +0,0 @@ - - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2011 Philippe Grand - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/comm/addpropal.php - * \ingroup propal - * \brief Page to add a new commercial proposal - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; -if (! empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; -} - -$langs->load("propal"); -if (! empty($conf->projet->enabled)) - $langs->load("projects"); -$langs->load("companies"); -$langs->load("bills"); -$langs->load("orders"); -$langs->load("deliveries"); - -$action=GETPOST('action','alpha'); -$origin=GETPOST('origin','alpha'); -$originid=GETPOST('originid','int'); - -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('propalcard')); - -/* - * Actions - */ - -// None - - - -/* - * View - */ - -llxHeader(); - -print_fiche_titre($langs->trans("NewProp")); - -$form=new Form($db); - -// Add new proposal -if ($action == 'create') -{ - $soc = new Societe($db); - $result=$soc->fetch($_GET["socid"]); - if ($result < 0) - { - dol_print_error($db,$soc->error); - exit; - } - - $object = new Propal($db); - - $numpr=''; - $obj = $conf->global->PROPALE_ADDON; - if ($obj) - { - if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) - { - require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.'.php'; - $modPropale = new $obj; - $numpr = $modPropale->getNextValue($soc,$object); - } - } - - // Fix pour modele numerotation qui deconne - // Si numero deja pris (ne devrait pas arriver), on incremente par .num+1 - $sql = "SELECT count(*) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."propal"; - $sql.= " WHERE ref LIKE '".$numpr."%'"; - $sql.= " AND entity = ".$conf->entity; - - $resql=$db->query($sql); - if ($resql) - { - $obj=$db->fetch_object($resql); - $num = $obj->nb; - $db->free($resql); - if ($num > 0) - { - $numpr .= "." . ($num + 1); - } - } - - print '
'; - print ''; - print ''; - - if ($origin != 'project' && $originid) - { - print ''; - print ''; - } - - print ''; - - // Ref - print ''; - print ''; - print ''; - print ''; - - // Ref customer - print ''; - print ''; - - // Third party - print ''; - print ''; - - // Contacts - print "'; - - // Ligne info remises tiers - print ''; - - // Date - print ''; - - // Validaty duration - print ''; - - // Terms of payment - print ''; - - // Mode of payment - print ''; - - // What trigger creation - print ''; - - // Delivery delay - print ''; - - // Delivery date (or manufacturing) - print ''; - print ''; - - // Model - print ''; - print ''; - print '"; - - // Project - if (! empty($conf->projet->enabled)) - { - $projectid = 0; - if ($origin == 'project') $projectid = ($originid?$originid:0); - - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } - } - - print "
'.$langs->trans("Ref").''.$numpr.'
'.$langs->trans('RefCustomer').''; - print '
'.$langs->trans('Company').''.$soc->getNomUrl(1); - print ''; - print '
".$langs->trans("DefaultContact")."\n"; - $form->select_contacts($soc->id,'','contactidp',1); - print '
'.$langs->trans('Discounts').''; - if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - $absolute_discount=$soc->getAvailableDiscounts(); - print '. '; - if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency)); - else print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.'; - print '
'.$langs->trans('Date').''; - $form->select_date('','','','','',"addprop"); - print '
'.$langs->trans("ValidityDuration").' '.$langs->trans("days").'
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id'); - print '
'.$langs->trans('PaymentMode').''; - $form->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); - print '
'.$langs->trans('Source').''; - $form->select_demand_reason('','demand_reason_id',"SRC_PROP",1); - print '
'.$langs->trans('AvailabilityPeriod').''; - $form->select_availability('','availability_id','',1); - print '
'.$langs->trans("DeliveryDate").''; - if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") - { - $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - $syear = date("Y", $tmpdte); - $smonth = date("m", $tmpdte); - $sday = date("d", $tmpdte); - $form->select_date($syear."-".$smonth."-".$sday,'liv_','','','',"addprop"); - } - else - { - $datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; - $form->select_date($datepropal,'liv_','','','',"addprop"); - } - print '
'.$langs->trans("DefaultModel").''; - $liste=ModelePDFPropales::liste_modeles($db); - print $form->selectarray('model',$liste,$conf->global->PROPALE_ADDON_PDF); - print "
'.$langs->trans("Project").''; - - $numprojet=select_projects($soc->id,$projectid); - if ($numprojet==0) - { - print '   '.$langs->trans("AddProject").''; - } - print '
'; - print $extrafields->showInputField($key,$value); - print '
"; - print '
'; - - /* - * Combobox pour la fonction de copie - */ - - if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) - { - print ''; - } - - print ''; - if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) - { - // For backward compatibility - print ''; - print ''; - print ''; - print ''; - - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print ''; - - print ''; - print ''; - } - - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - { - print ''; - } - print '
'.$langs->trans("CopyPropalFrom").' '; - $liste_propal = array(); - $liste_propal[0] = ''; - - $sql ="SELECT p.rowid as id, p.ref, s.nom"; - $sql.=" FROM ".MAIN_DB_PREFIX."propal p"; - $sql.= ", ".MAIN_DB_PREFIX."societe s"; - $sql.= " WHERE s.rowid = p.fk_soc"; - $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND p.fk_statut <> 0"; - $sql.= " ORDER BY Id"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $propalRefAndSocName = $row[1]." - ".$row[2]; - $liste_propal[$row[0]]=$propalRefAndSocName; - $i++; - } - print $form->selectarray("copie_propal",$liste_propal, 0); - } - else - { - dol_print_error($db); - } - print '
 
'.$langs->trans("CreateEmptyPropal").'
'; - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) - { - $lib=$langs->trans("ProductsAndServices"); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) - { - print ''; - print ''; - print ''; - print ''; - } - - print "
'.$lib.''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'
'; - // multiprix - if($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) - $form->select_produits('',"idprod".$i,'',$conf->product->limit_size,$soc->price_level); - else - $form->select_produits('',"idprod".$i,'',$conf->product->limit_size); - print '%
"; - - } - print '
'; - print '
'; - - $langs->load("bills"); - print '
'; - print ''; - print ' '; - print '
'; - - print "
"; -} - - -llxFooter(); -$db->close(); -?> From 4cb6072f030d7cbf1e4673e10ba90a09c7015ae5 Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 21 Feb 2013 11:03:14 +0100 Subject: [PATCH 2/4] New: [ task #707 ] Create option ProfIdx are mandatory to validate a invoice --- ChangeLog | 1 + htdocs/compta/facture.php | 18 +++++++++++++++- htdocs/langs/ca_ES/admin.lang | 3 ++- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/es_ES/admin.lang | 3 ++- htdocs/langs/fr_FR/admin.lang | 3 ++- htdocs/societe/admin/societe.php | 35 +++++++++++++++++++++++++++++++- 7 files changed, 60 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1a44ef58e0..69f6556871d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 212429be67e..1753eb4b75a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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); diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 5bbc3472c98..a80324836cc 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -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 diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cc5d50c5139..ce66a55f944 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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 diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index cbf15193742..8013b56c2fb 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -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 diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 46df03e5c63..f0e8198086d 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -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 diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 1b0efa2c4b2..1cd6fef8b4b 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -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 ''.$langs->trans("Name").''; print ''.$langs->trans("Description").''; print ''.$langs->trans("MustBeUnique").''; print ''.$langs->trans("MustBeMandatory").''; +print ''.$langs->trans("MustBeInvoiceMandatory").''; print "\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 ''; } + + if ($invoice_mandatory) + { + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + } + else + { + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + } + print "\n"; } $i++; From 8e6cde61c07e8fca3b00fa9b787cb630727122e4 Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 21 Feb 2013 18:44:11 +0100 Subject: [PATCH 3/4] Trad: Update translations --- htdocs/langs/ca_ES/main.lang | 1 + htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/es_ES/main.lang | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/ca_ES/main.lang b/htdocs/langs/ca_ES/main.lang index e1f2413c829..bfb93f9ca0c 100644 --- a/htdocs/langs/ca_ES/main.lang +++ b/htdocs/langs/ca_ES/main.lang @@ -565,6 +565,7 @@ ThisLimitIsDefinedInSetup=Límit Dolibarr (Menú inici-configuració-seguretat): NoFileFound=No hi ha documents guardats en aquesta carpeta CurrentUserLanguage=Idioma actual CurrentTheme=Tema actual +CurrentMenuManager=Gestor menú actual DisabledModules=Mòduls desactivats For=Per a ForCustomer=Per a client diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c24a0bd4ceb..0bc8e8d9451 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -566,7 +566,7 @@ ThisLimitIsDefinedInSetup=Dolibarr limit (Menu home-setup-security): %s Kb, PHP NoFileFound=No documents saved in this directory CurrentUserLanguage=Current language CurrentTheme=Current theme -CurrentMenuManager=current men manager +CurrentMenuManager=current menu manager DisabledModules=Disabled modules For=For ForCustomer=For customer diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index dbafcb393b2..4cc16bc5e55 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -567,6 +567,7 @@ ThisLimitIsDefinedInSetup=Límite Dolibarr (Menú inicio-configuración-segurida NoFileFound=No hay documentos guardados en este directorio CurrentUserLanguage=Idioma actual CurrentTheme=Tema actual +CurrentMenuManager=Gestor menú actual DisabledModules=Módulos desactivados For=Para ForCustomer=Para cliente From 5d357c7736b03b1159f53c43d343bad91b623dae Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 21 Feb 2013 18:48:56 +0100 Subject: [PATCH 4/4] Trad: Fix activity box translation --- htdocs/core/boxes/box_activity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 3a9a5a484ec..1977e41970a 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -71,7 +71,7 @@ class box_activity extends ModeleBoxes $nbofyears=2; if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION; - $textHead = $langs->trans("Activity").' ('.$nbofyears.' '.$langs->trans("years").')'; + $textHead = $langs->trans("Activity").' ('.$nbofyears.' '.$langs->trans("DurationYears").')'; $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // compute the year limit to show