diff --git a/ChangeLog b/ChangeLog index 361cd1145ba..803703caf9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,10 +62,12 @@ For users: - New: Can choose menu entry to show with external site module. - New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM to force margins of generated PDF. +- New: [ task #314 ] Can define if prof id are mandatory or not New experimental modules: - New: Add margin management module. - New: Add commissions management module. + - Fix: [ bug #499 ]: Supplier order input method not translated - Fix: No images into product description lines as PDF generation does not work with this. diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 06873ef9f89..c5dce9389a6 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -949,6 +949,7 @@ DocumentModelOdt=Generació des dels documents amb format OpenDocument (Arxiu .O WatermarkOnDraft=Marca d'aigua en els documents esborrany CompanyIdProfChecker=Id Professional únic MustBeUnique=Ha de ser únic? +MustBeMandatory=Ha de ser obligatori? Miscellanous=Miscel·lània ##### Webcal setup ##### WebCalSetup=Configuració d'enllaç amb el calendari webcalendar diff --git a/htdocs/langs/ca_ES/companies.lang b/htdocs/langs/ca_ES/companies.lang index caa0cfe0174..63ae033cd98 100644 --- a/htdocs/langs/ca_ES/companies.lang +++ b/htdocs/langs/ca_ES/companies.lang @@ -108,42 +108,49 @@ ProfId2AR=Ingressos bruts ProfId3AR=- ProfId4AR=- ProfId5AR=- +ProfId6AR=- ProfId1AU=ABN ProfId2AU=- ProfId3AU=- ProfId4AU=- ProfId5AU=- +ProfId6AU=- ProfId1BE=N° col·legiat ProfId2BE=- ProfId3BE=- ProfId4BE=- ProfId5BE=- -ProfId1BR=CNPJ +ProfId6BE=- +ProfId1BR=- ProfId2BR=IE (Inscricao Estadual) ProfId3BR=IM (Inscricao Municipal) ProfId4BR=CPF -#ProfId5BR=CNAE= -#ProfId6BR=INSS= +#ProfId5BR=CNAE +#ProfId6BR=INSS ProfId1CH=- ProfId2CH=- ProfId3CH=Número federat ProfId4CH=Num registre de comerç ProfId5CH=- +ProfId6CH=- ProfId1CL=R.U.T. ProfId2CL=- ProfId3CL=- ProfId4CL=- ProfId5CL=- +ProfId6CL=- ProfId1CO=R.U.T. ProfId2CO=- ProfId3CO=- ProfId4CO=- ProfId5CO=- +ProfId6CO=- ProfId1DE=Id prof. 1 (USt.-IdNr) ProfId2DE=Id prof. 2 (USt.-Nr) ProfId3DE=Id prof. 3 (Handelsregister-Nr.) ProfId4DE=- ProfId5DE=- +ProfId6DE=- ProfId1ES=CIF/NIF ProfId2ES=Núm seguretat social ProfId3ES=CNAE @@ -161,51 +168,61 @@ ProfId2GB=- ProfId3GB=SIC ProfId4GB=- ProfId5GB=- +ProfId6GB=- ProfId1HN=RTN ProfId2HN=- ProfId3HN=- ProfId4HN=- ProfId5HN=- +ProfId6HN=- ProfId1IN=Id prof. 1 (TIN) -ProfId2IN=Id prof. 2 -ProfId3IN=Id prof. 3 +ProfId2IN=Id prof. 2 (PAN) +ProfId3IN=Id prof. 3 (SRVC TAX) ProfId4IN=Id prof. 4 ProfId5IN=Id prof. 5 +ProfId6IN=- ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) ProfId5MA=- +ProfId6MA=- ProfId1MX=R.F.C. ProfId2MX=Registre Patronal IMSS ProfId3MX=Cèdula Professional ProfId4MX=- ProfId5MX=- +ProfId6MX=- ProfId1NL=Número KVK ProfId2NL=- ProfId3NL=- ProfId4NL=- ProfId5NL=- +ProfId6NL=- ProfId1PT=NIPC ProfId2PT=Núm seguretat social ProfId3PT=Num reg. comercial ProfId4PT=Conservatori ProfId5PT=- +ProfId6PT=- ProfId1RU=OGRN ProfId2RU=INN ProfId3RU=KPP ProfId4RU=OKPO ProfId5RU=- +ProfId6RU=- ProfId1SN=RC ProfId2SN=NINEA ProfId3SN=- ProfId4SN=- ProfId5SN=- +ProfId6SN=- ProfId1TN=RC ProfId2TN=Matrícula fiscal ProfId3TN=Codi en aduana ProfId4TN=CCC ProfId5TN=- +ProfId6TN=- VATIntra=NIF intracomunitari VATIntraShort=NIF intra. VATIntraVeryShort=NIF intra. diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index fd43de81c10..ec04e3ff9ce 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -21,6 +21,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Aquest contacte ja està definit com ErrorCashAccountAcceptsOnlyCashMoney=Aquesta compte bancari és de tipus caixa i només accepta el mètode de pagament de tipus espècie. ErrorFromToAccountsMustDiffers=El compte origen i destinació han de ser diferents. ErrorBadThirdPartyName=Nom de tercer incorrecte +ErrorProdIdIsMandatory=El %s es obligatori ErrorBadCustomerCodeSyntax=La sintaxi del codi client és incorrecta ErrorCustomerCodeRequired=Codi client obligatori ErrorCustomerCodeAlreadyUsed=Codi de client ja utilitzat diff --git a/htdocs/langs/ca_ES/margins.lang b/htdocs/langs/ca_ES/margins.lang index f502a3274bf..62bb253a587 100644 --- a/htdocs/langs/ca_ES/margins.lang +++ b/htdocs/langs/ca_ES/margins.lang @@ -46,4 +46,8 @@ MargeNette=Marge net MARGIN_TYPE_DETAILS=Marge brut: Preu de venda sense IVA - Preu de compra sense IVA
Marge net: Preu de venda sense IVA - Costos BuyingCost=Costos -UnitCharges=Càrrega unitària \ No newline at end of file +UnitCharges=Càrrega unitària +Charges=Càrreges + +AgentContactType=Tipus de contacte comissionat +AgentContactTypeDetails=Indica el tipus de contacte enllaçat a les factures que seran associats als agents comercials \ No newline at end of file diff --git a/htdocs/langs/ca_ES/products.lang b/htdocs/langs/ca_ES/products.lang index f1c0fbb0616..71d8d426d2c 100644 --- a/htdocs/langs/ca_ES/products.lang +++ b/htdocs/langs/ca_ES/products.lang @@ -146,6 +146,8 @@ ProductSpecial=Especial QtyMin=Quantitat mínima PriceQty=Preu per la quantitat PriceQtyMin=Preu quantitat min. +DiscountQtyMin=Descompte per defecte quantitat min. +VATRateForSupplierProduct=Taxa IVA (per aquest producte/proveïdor) NoPriceDefinedForThisSupplier=Cap preu/quant. definit per a aquest proveïdor/producte NoSupplierPriceDefinedForThisProduct=Cap preu/quant. proveïdor definit per a aquest producte RecordedProducts=Productes en venda diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6a50d4b087a..b07c69d7259 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -939,6 +939,7 @@ DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT files for WatermarkOnDraft=Watermark on draft document CompanyIdProfChecker=Professional Id unique MustBeUnique=Must be unique ? +MustBeMandatory=Must be mandatory ? Miscellanous=Miscellaneous ##### Webcal setup ##### WebCalSetup=Webcalendar link setup diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 19a36f64c22..f2f537453e7 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -25,6 +25,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as co ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only. ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be different. ErrorBadThirdPartyName=Bad value for third party name +ErrorProdIdIsMandatory=The %s is mandatory ErrorBadCustomerCodeSyntax=Bad syntax for customer code ErrorCustomerCodeRequired=Customer code required ErrorCustomerCodeAlreadyUsed=Customer code already used diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index 41203847ba5..10a8112f87e 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -47,6 +47,7 @@ MARGIN_TYPE_DETAILS=Raw margin : Selling price - Buying price
Net margin : S BuyingCost=Cost price UnitCharges=Unit charges +Charges=Charges AgentContactType=Contact type used for commissioning AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents \ No newline at end of file diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index d5a9df404a9..3a43d9c67b3 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -952,6 +952,7 @@ DocumentModelOdt=Generación desde los documentos OpenDocument (Archivo .ODT Ope WatermarkOnDraft=Marca de agua en los documentos borrador CompanyIdProfChecker=Id Profesional único MustBeUnique=¿Debe ser único? +MustBeMandatory=¿Debe ser obligatorio? Miscellanous=Miscelánea ##### Webcal setup ##### WebCalSetup=Configuración de enlace con el calendario Webcalendar diff --git a/htdocs/langs/es_ES/companies.lang b/htdocs/langs/es_ES/companies.lang index 9313df97434..511921a014b 100644 --- a/htdocs/langs/es_ES/companies.lang +++ b/htdocs/langs/es_ES/companies.lang @@ -109,17 +109,20 @@ ProfId2AR=Ingresos brutos ProfId3AR=- ProfId4AR=- ProfId5AR=- +ProfId6AR=- ProfId1AU=ABN ProfId2AU=- ProfId3AU=- ProfId4AU=- ProfId5AU=- +ProfId6AU=- ProfId1BE=N° colegiado ProfId2BE=- ProfId3BE=- ProfId4BE=- ProfId5BE=- -ProfId1BR=CNPJ +ProfId6BE=- +ProfId1BR=- ProfId2BR=IE (Inscricao Estadual) ProfId3BR=IM (Inscricao Municipal) ProfId4BR=CPF @@ -130,21 +133,25 @@ ProfId2CH=- ProfId3CH=Número federado ProfId4CH=Num registro de comercio ProfId5CH=- +ProfId6CH=- ProfId1CL=R.U.T. ProfId2CL=- ProfId3CL=- ProfId4CL=- ProfId5CL=- +ProfId6CL=- ProfId1CO=R.U.T. ProfId2CO=- ProfId3CO=- ProfId4CO=- ProfId5CO=- +ProfId6CO=- ProfId1DE=Id prof. 1 (USt.-IdNr) ProfId2DE=Id prof. 2 (USt.-Nr) ProfId3DE=Id prof. 3 (Handelsregister-Nr.) ProfId4DE=- ProfId5DE=- +ProfId6DE=- ProfId1ES=CIF/NIF ProfId2ES=Núm seguridad social ProfId3ES=CNAE @@ -162,51 +169,61 @@ ProfId2GB=- ProfId3GB=SIC ProfId4GB=- ProfId5GB=- +ProfId6GB=- ProfId1HN=RTN ProfId2HN=- ProfId3HN=- ProfId4HN=- ProfId5HN=- +ProfId6HN=- ProfId1IN=Id prof. 1 (TIN) ProfId2IN=Id prof. 2 ProfId3IN=Id prof. 3 ProfId4IN=Id prof. 4 ProfId5IN=Id prof. 5 +ProfId6IN=- ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 +ProfId5MA=- +ProfId6MA=- ProfId1MX=R.F.C. ProfId2MX=Registro Patronal IMSS ProfId3MX=Cédula Profesional ProfId4MX=- ProfId5MX=- +ProfId6MX=- ProfId1NL=Número KVK ProfId2NL=- ProfId3NL=- ProfId4NL=- ProfId5NL=- +ProfId6NL=- ProfId1PT=NIPC ProfId2PT=Núm. seguridad social ProfId3PT=Num reg. comercial ProfId4PT=Conservatorio ProfId5PT=- +ProfId6PT=- ProfId1RU=OGRN ProfId2RU=INN ProfId3RU=KPP ProfId4RU=OKPO ProfId5RU=- +ProfId6RU=- ProfId1SN=RC ProfId2SN=NINEA ProfId3SN=- ProfId4SN=- ProfId5SN=- +ProfId6SN=- ProfId1TN=RC ProfId2TN=Matrícula fiscal ProfId3TN=Código en aduana ProfId4TN=CCC ProfId5TN=- +ProfId6TN=- VATIntra=NIF intracomunitario VATIntraShort=NIF intra. VATIntraVeryShort=NIF intra. diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index 580627e6cab..d723910a5bd 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -21,6 +21,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Este contacto ya está definido como ErrorCashAccountAcceptsOnlyCashMoney=Esta cuenta bancaria es de tipo caja y solo acepta el método de pago de tipo especie. ErrorFromToAccountsMustDiffers=La cuenta origen y destino deben ser diferentes. ErrorBadThirdPartyName=Nombre de tercero incorrecto +ErrorProdIdIsMandatory=El %s es obligatorio ErrorBadCustomerCodeSyntax=La sintaxis del código cliente es incorrecta ErrorCustomerCodeRequired=Código cliente obligatorio ErrorCustomerCodeAlreadyUsed=Código de cliente ya utilizado diff --git a/htdocs/langs/es_ES/margins.lang b/htdocs/langs/es_ES/margins.lang index 5ff7b74b7d4..0dc08481c46 100644 --- a/htdocs/langs/es_ES/margins.lang +++ b/htdocs/langs/es_ES/margins.lang @@ -46,4 +46,8 @@ MargeNette=Margen neto MARGIN_TYPE_DETAILS=Margen bruto : Precio de venta sin IVA - Precio de compra sin IVA
Margen neto : Precio de venta sin IVA - Costos BuyingCost=Costos -UnitCharges=Carga unitaria \ No newline at end of file +UnitCharges=Carga unitaria +Charges=Cargas + +AgentContactType=Tipo de contacto comisionado +AgentContactTypeDetails=Indica el tipo de contacto enlazado a las facturas que serán asociados a los agentes comerciales \ No newline at end of file diff --git a/htdocs/langs/es_ES/products.lang b/htdocs/langs/es_ES/products.lang index 97d4586bae6..a3c2bf41eb7 100644 --- a/htdocs/langs/es_ES/products.lang +++ b/htdocs/langs/es_ES/products.lang @@ -146,6 +146,8 @@ ProductSpecial=Especial QtyMin=Cantidad mínima PriceQty=Precio para la cantidad PriceQtyMin=Precio cantidad mín. +DiscountQtyMin=Descuento por defecto cantidad mín. +VATRateForSupplierProduct=Tasa IVA (para este producto/proveedor) NoPriceDefinedForThisSupplier=Ningún precio/cant. definido para este proveedor/producto NoSupplierPriceDefinedForThisProduct=Ningún precio/cant. proveedor definida para este producto RecordedProducts=Productos en venta diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 6afab6c47ab..000a58860f9 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -946,6 +946,7 @@ DocumentModelOdt=Genération depuis des modèles OpenDocument (Fichier .ODT Open WatermarkOnDraft=Filigrane sur les documents brouillons CompanyIdProfChecker=Id professionel unique MustBeUnique=Doit être unique ? +MustBeMandatory=Doit être obligatoire? Miscellanous=Divers ##### Webcal setup ##### WebCalSetup= Configuration du lien vers le calendrier Webcalendar diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 87715bea1fe..b6fcbb6611b 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -26,6 +26,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est déjà défini comme c ErrorCashAccountAcceptsOnlyCashMoney=Ce compte bancaire est de type caisse et n'accepte que les mode de règlement de type espèce. ErrorFromToAccountsMustDiffers=Le compte source et destination doivent être différents. ErrorBadThirdPartyName=Nom de tiers incorrect +ErrorProdIdIsMandatory=Le %s est obligatoire ErrorBadCustomerCodeSyntax=La syntaxe du code client est incorrecte ErrorCustomerCodeRequired=Code client obligatoire ErrorCustomerCodeAlreadyUsed=Code client déjà utilisé diff --git a/htdocs/langs/fr_FR/margins.lang b/htdocs/langs/fr_FR/margins.lang index 02dfedbbe9a..3c81a9a1e4d 100644 --- a/htdocs/langs/fr_FR/margins.lang +++ b/htdocs/langs/fr_FR/margins.lang @@ -47,6 +47,7 @@ MARGIN_TYPE_DETAILS=Marge brute : Prix de vente HT - Prix d'achat HT
Marge n BuyingCost=Coût de revient UnitCharges=Charge unitaire +Charges=Charges AgentContactType=Type de contact commissionné AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux \ No newline at end of file diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index ce68665cb69..443b0bc4be4 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -1380,7 +1380,7 @@ print "\n
\n"; * All the "Add to" areas */ -if ($id && ($action == '' || $action == 'view') && $object->status) +if ($object->id && ($action == '' || $action == 'view') && $object->status) { print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 4f631358c9f..380fb625b21 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -34,6 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $langs->load("products"); $langs->load("suppliers"); $langs->load("bills"); +// Charges ???? +if (! empty($conf->margin->enabled)) $langs->load("margins"); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index bfff310636f..32ad23eafbe 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -195,6 +195,23 @@ if ($action == 'setprofid') } } +//Activate ProfId +if ($action == 'setprofidmandatory') +{ + $status = GETPOST('status','alpha'); + + $idprof="SOCIETE_IDPROF".$value."_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 @@ -522,6 +539,7 @@ print ''; print ''; print ''; print ''; +print ''; print "\n"; $profid[0][0]=$langs->trans("ProfId1"); @@ -532,6 +550,10 @@ $profid[2][0]=$langs->trans("ProfId3"); $profid[2][1]=$langs->transcountry('ProfId3', $mysoc->country_code); $profid[3][0]=$langs->trans("ProfId4"); $profid[3][1]=$langs->transcountry('ProfId4', $mysoc->country_code); +$profid[4][0]=$langs->trans("ProfId5"); +$profid[4][1]=$langs->transcountry('ProfId5', $mysoc->country_code); +$profid[5][0]=$langs->trans("ProfId6"); +$profid[5][1]=$langs->transcountry('ProfId6', $mysoc->country_code); $var = true; $i=0; @@ -539,42 +561,47 @@ $i=0; $nbofloop=count($profid); while ($i < $nbofloop) { - $var = !$var; - - print ''; - print ''; - - switch($i) + if ($profid[$i][1]!='-') { - case 0: - $verif=(empty($conf->global->SOCIETE_IDPROF1_UNIQUE)?false:true); - break; - case 1: - $verif=(empty($conf->global->SOCIETE_IDPROF2_UNIQUE)?false:true); - break; - case 2: - $verif=(empty($conf->global->SOCIETE_IDPROF3_UNIQUE)?false:true); - break; - case 3: - $verif=(empty($conf->global->SOCIETE_IDPROF4_UNIQUE)?false:true); - break; + $var = !$var; + + print ''; + print ''; + + $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; + $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; + $verif=(empty($conf->global->$idprof_unique)?false:true); + $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); + + if ($verif) + { + print ''; + } + else + { + print ''; + } + + if ($mandatory) + { + print ''; + } + else + { + print ''; + } + print "\n"; } - - if ($verif) - { - print ''; - } - else - { - print ''; - } - print "\n"; $i++; } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 45caee823b1..26c453607ec 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Patrick Raguin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * * 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 @@ -202,9 +202,18 @@ if (empty($reshook)) $error++; $errors[] = $langs->trans("ErrorSupplierModuleNotEnabled"); $action = ($action=='add'?'create':'edit'); } + + // We set country_id, country_code and country for the selected country + $object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; + if ($object->country_id) + { + $tmparray=getCountry($object->country_id,'all'); + $object->country_code=$tmparray['code']; + $object->country=$tmparray['label']; + } - // Check for duplicate prof id - for ($i = 1; $i < 3; $i++) + // Check for duplicate or mandatory prof id + for ($i = 1; $i < 5; $i++) { $slabel="idprof".$i; $_POST[$slabel]=trim($_POST[$slabel]); @@ -218,8 +227,18 @@ if (empty($reshook)) $action = ($action=='add'?'create':'edit'); } } + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $error++; + $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); + $action = ($action=='add'?'create':'edit'); + } } } + if (! $error) { if ($action == 'add') @@ -293,7 +312,7 @@ if (empty($reshook)) // Gestion du logo de la société } else - { + { $error=$object->error; $errors=$object->errors; } @@ -834,7 +853,13 @@ else if ($idprof!='-') { if (($j % 2) == 0) print ''; - print ''; @@ -1271,7 +1296,13 @@ else if ($idprof!='-') { if (($j % 2) == 0) print ''; - print '';
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("MustBeUnique").''.$langs->trans("MustBeMandatory").'
'.$profid[$i][0]."\n"; - print $profid[$i][1]; - print '
'.$profid[$i][0]."\n"; + print $profid[$i][1]; + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print '
'; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print '
'.$idprof.''; + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if(empty($conf->global->$idprof_mandatory)) + print ''.$idprof.''; + else + print ''.$idprof.''; + $key='idprof'.$i; print $formcompany->get_input_id_prof($i,'idprof'.$i,$object->$key,$object->country_code); print '
'.$idprof.''; + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if(empty($conf->global->$idprof_mandatory)) + print ''.$idprof.''; + else + print ''.$idprof.''; + $key='idprof'.$i; print $formcompany->get_input_id_prof($i,'idprof'.$i,$object->$key,$object->country_code); print '