diff --git a/ChangeLog b/ChangeLog index c88e1554a6a..30de710764b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -128,7 +128,7 @@ parameter. All methods addline in this case were modified to remove this paramet 5) Property ->tel on objects is now ->phone - + ***** ChangeLog for 3.4.2 compared to 3.4.1 ***** Fix: field's problem into company's page (RIB) Fix: Document cerfa doesn't contained firstname & lastname from donator @@ -140,6 +140,14 @@ Fix: [ bug #1142 ] Set paiement on invoice (PGSql) Fix: [ bug #1145 ] Agenda button list type do not display Fix: [ bug #1148 ] Product consomation : supplier order bad status Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists +Fix: [ bug #1174 ] Product translated description not good into PDF +Fix: [ bug #1163 ] SQL Error when searching for supplier orders +Fix: [ bug #1162 ] Translaction for morning and afternoon +Fix: [ bug #1161 ] Search on product label +Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed payment mode. +Fix: [ bug #1171 ] Documents lost in interventions after validating +Fix: fix unsubscribe URL into mailing when sending manually (not by script) +Fix: [ bug #1182 ] ODT company_country tag is htmlencoded ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined @@ -170,7 +178,6 @@ Fix: there was no escaping on filter fields in supplier product list Fix: bugs on margin reports and better margin calculation on credit notes Qual: Add travis-ci integration - ***** ChangeLog for 3.4 compared to 3.3.* ***** For users: - New: Can use ODS templates as document templates. diff --git a/build/doxygen/doxygen_footer.html b/build/doxygen/doxygen_footer.html index 38985bb5c27..1f4cbd00215 100755 --- a/build/doxygen/doxygen_footer.html +++ b/build/doxygen/doxygen_footer.html @@ -22,7 +22,7 @@ File added into doxygen generated documentation +for $projectname by Doxygen $doxygenversion @@ -40,5 +40,6 @@ google_ad_height = 60;
+ \ No newline at end of file diff --git a/htdocs/.gitignore b/htdocs/.gitignore index fadc5632733..a4ebd2bb7c7 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -1,11 +1,11 @@ /test.php /custom* -/bootstrap -/extensions -/google -/multicompany -/numberingpack -/ovh +/extensions* +/nltechno* +/bootstrap* +/google* +/multicompany* +/numberingpack* +/ovh* /pos -/skincoloreditor -/ultimatepdf +/ultimatepdf* diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index ad77a9ba8c7..26611da68ee 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -292,14 +292,14 @@ if ($action == 'edit' || $action == 'updateedit') // Country $var=!$var; - print ''.$langs->trans("Country").''; + print ''.$langs->trans("Country").''; //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation print $form->select_country($mysoc->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''."\n"; $var=!$var; - print ''.$langs->trans("State").''; + print ''.$langs->trans("State").''; $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE,$mysoc->country_code,'state_id'); print ''."\n"; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 94c660c9a3f..ae4b9eb35dd 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -42,9 +42,6 @@ $consts=GETPOST('const'); $constname=GETPOST('constname','alpha'); $constvalue=GETPOST('constvalue'); $constnote=GETPOST('constnote','alpha'); -$consttype=(GETPOST('consttype','alpha')?GETPOST('consttype','alpha'):'chaine'); - -$typeconst=array('yesno' => 'yesno', 'texte' => 'texte', 'chaine' => 'chaine'); @@ -52,7 +49,7 @@ $typeconst=array('yesno' => 'yesno', 'texte' => 'texte', 'chaine' => 'chaine'); * Actions */ -if ($action == 'add') +if ($action == 'add' || (GETPOST('add') && $action != 'update')) { $error=0; @@ -69,9 +66,13 @@ if ($action == 'add') if (! $error) { - if (dolibarr_set_const($db, $constname, $constvalue, $typeconst[$consttype], 1, $constnote, $entity) >= 0) + if (dolibarr_set_const($db, $constname, $constvalue, 'chaine', 1, $constnote, $entity) >= 0) { setEventMessage($langs->trans("RecordSaved")); + $action=""; + $constname=""; + $constvalue=""; + $constnote=""; } else { @@ -176,6 +177,10 @@ print_fiche_titre($langs->trans("OtherSetup"),'','setup'); print $langs->trans("ConstDesc")."
\n"; print "
\n"; +print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; +print ''; +print ''; + print ''; print ''; print ''; @@ -189,15 +194,12 @@ print "\n"; // Line to add new record $var=false; print "\n"; -print ''; -print ''; -print ''; -print ''."\n"; +print ''."\n"; print ''; // Limit to superadmin if (! empty($conf->multicompany->enabled) && !$user->entity) @@ -205,22 +207,17 @@ if (! empty($conf->multicompany->enabled) && !$user->entity) print ''; + print '\n"; print ''; -print ''; -print "\n"; - -print 'entity) && $debug)?'?debug=1':'').'" method="POST">'; -print ''; -print ''; // Show constants $sql = "SELECT"; @@ -250,21 +247,20 @@ if ($result) $var=!$var; print "\n"; - print ''; - print ''; - print ''; print ''."\n"; // Value print ''; // Note - print ''; + print ''; // Entity limit to superadmin @@ -273,13 +269,14 @@ if ($result) print ''; + print ''; } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index b4e6ff2f628..0b0c9db4f17 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -136,44 +136,57 @@ foreach ($modulesdir as $dir) try { $res=include_once $dir.$file; - $objMod = new $modName($db); - $modNameLoaded[$modName]=$dir; + if (class_exists($modName)) + { + try { + $objMod = new $modName($db); + $modNameLoaded[$modName]=$dir; - if ($objMod->numero > 0) - { - $j = $objMod->numero; - } - else - { - $j = 1000 + $i; - } + if ($objMod->numero > 0) + { + $j = $objMod->numero; + } + else + { + $j = 1000 + $i; + } - $modulequalified=1; + $modulequalified=1; - // We discard modules according to features level (PS: if module is activated we always show it) - $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); - if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0; - if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0; - // We discard modules according to property disabled - if (isset($objMod->hidden) && $objMod->hidden) $modulequalified=false; - - // Define array $categ with categ with at least one qualified module - if ($modulequalified) - { - $modules[$i] = $objMod; - $filename[$i]= $modName; - $orders[$i] = $objMod->family."_".$j; // Sort by family, then by module number - $dirmod[$i] = $dir; - // Set categ[$i] - $special = isset($specialtostring[$objMod->special])?$specialtostring[$objMod->special]:'unknown'; - if ($objMod->version == 'development' || $objMod->version == 'experimental') $special='expdev'; - if (isset($categ[$special])) $categ[$special]++; // Array of all different modules categories - else $categ[$special]=1; - $j++; - $i++; - } - else dol_syslog("Module ".get_class($objMod)." not qualified"); - } + // We discard modules according to features level (PS: if module is activated we always show it) + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); + if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0; + if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0; + // We discard modules according to property disabled + if (isset($objMod->hidden) && $objMod->hidden) $modulequalified=false; + + // Define array $categ with categ with at least one qualified module + if ($modulequalified) + { + $modules[$i] = $objMod; + $filename[$i]= $modName; + $orders[$i] = $objMod->family."_".$j; // Sort by family, then by module number + $dirmod[$i] = $dir; + // Set categ[$i] + $special = isset($specialtostring[$objMod->special])?$specialtostring[$objMod->special]:'unknown'; + if ($objMod->version == 'development' || $objMod->version == 'experimental') $special='expdev'; + if (isset($categ[$special])) $categ[$special]++; // Array of all different modules categories + else $categ[$special]=1; + $j++; + $i++; + } + else dol_syslog("Module ".get_class($objMod)." not qualified"); + } + catch(Exception $e) + { + dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); + } + } + else + { + print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; + } + } catch(Exception $e) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 73fd45d9099..a4cc4fefc11 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -74,15 +74,27 @@ foreach($modulesdir as $dir) else { // File to load - include_once $dir.$file; - - $objMod = new $modName($db); - - $modules[$objMod->numero]=$objMod; - $modules_names[$objMod->numero]=$objMod->name; - $modules_files[$objMod->numero]=$file; - $modules_fullpath[$file]=$dir.$file; - $picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic'; + $res=include_once $dir.$file; + if (class_exists($modName)) + { + try { + $objMod = new $modName($db); + + $modules[$objMod->numero]=$objMod; + $modules_names[$objMod->numero]=$objMod->name; + $modules_files[$objMod->numero]=$file; + $modules_fullpath[$file]=$dir.$file; + $picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic'; + } + catch(Exception $e) + { + dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); + } + } + else + { + print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; + } } } } diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index 980bd9ef4bb..2b930b8afc1 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2013 Laurent Destailleur * * 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 diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 447e065219e..6a963c23658 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -700,6 +700,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $price_min=0; $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); + $db->begin(); + // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit @@ -858,6 +860,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- if ($result > 0) { + $db->commit(); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { // Define output language @@ -898,6 +902,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } else { + $db->rollback(); + setEventMessage($object->error, 'errors'); } } @@ -978,9 +984,11 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa $error++; } } - + if (! $error) { + $db->begin(); + $result = $object->updateline( GETPOST('lineid'), $pu_ht, @@ -1006,6 +1014,8 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa if ($result >= 0) { + $db->commit(); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { // Define output language @@ -1035,6 +1045,8 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa } else { + $db->rollback(); + setEventMessage($object->error, 'errors'); } } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9679f430807..6054270d002 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1422,7 +1422,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } } -elseif ($action == 'updateligne' && $user->rights->facture->creer && $_POST['save'] == $langs->trans('Save')) +elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel')) { if (! $object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index cab62777291..a0d181e8f81 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ $langs->load("compta"); $langs->load("banks"); $langs->load("bills"); -$id=GETPOST("id"); +$id=GETPOST("id",'int'); $action=GETPOST('action'); // Security check @@ -87,7 +87,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) if ($action == 'delete') { - $result=$tva->fetch($_GET['id']); + $result=$tva->fetch($id); if ($tva->rappro == 0) { @@ -100,10 +100,10 @@ if ($action == 'delete') { $accountline=new AccountLine($db); $result=$accountline->fetch($tva->fk_bank); - $result=$accountline->delete($user); + if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) } - if ($result > 0) + if ($result >= 0) { $db->commit(); header("Location: ".DOL_URL_ROOT.'/compta/tva/reglement.php'); @@ -289,4 +289,4 @@ if ($id) $db->close(); llxFooter(); -?> \ No newline at end of file +?> diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 988faa8593a..56aa234b3c9 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -29,9 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("other"); +$langs->load("compta"); -$year=$_GET["year"]; -if ($year == 0 ) +$year=GETPOST("year","int"); +if ($year == 0) { $year_current = strftime("%Y",time()); $year_start = $year_current; @@ -51,7 +52,14 @@ $modetax = $conf->global->TAX_MODE; if (isset($_GET["modetax"])) $modetax=$_GET["modetax"]; - +/** + * pt + * + * @param DoliDB $db Database handler + * @param string $sql SQL Request + * @param date $date Date + * @return void + */ function pt ($db, $sql, $date) { global $conf, $bc,$langs; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 024cc4922d1..64cef78239d 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2013 Alexandre Spangaro * * 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 @@ -951,37 +951,35 @@ class Contact extends CommonObject if ($mode == 0) { - if ($statut==0) return $langs->trans('Disabled'); - elseif ($statut==1) return $langs->trans('Enabled'); + if ($statut==0 || $statut==5) return $langs->trans('Disabled'); + elseif ($statut==1 || $statut==4) return $langs->trans('Enabled'); } elseif ($mode == 1) { - if ($statut==0) return $langs->trans('Disabled'); - elseif ($statut==1) return $langs->trans('Enabled'); + if ($statut==0 || $statut==5) return $langs->trans('Disabled'); + elseif ($statut==1 || $statut==4) return $langs->trans('Enabled'); } elseif ($mode == 2) { - if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - elseif ($statut==1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); } elseif ($mode == 3) { - if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5'); - elseif ($statut==1) return img_picto($langs->trans('Enabled'),'statut4'); - + if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'),'statut5'); + elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4'); } elseif ($mode == 4) { if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('StatusContactDraft'); - elseif ($statut==1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); } elseif ($mode == 5) { - if ($statut==0) return ''.$langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - elseif ($statut==1) return ''.$langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($statut==0 || $statut==5) return ''.$langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + elseif ($statut==1 || $statut==4) return ''.$langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); } - } diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 3334a12b069..88585a230af 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2013 Alexandre Spangaro * * 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 @@ -432,14 +432,14 @@ else if ($socid > 0) { print ''; - print ''; print ''; print ''; } else { - print ''; } @@ -474,13 +474,13 @@ else // Zip / Town if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) $object->zip = $objsoc->zip; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) $object->town = $objsoc->town; // Predefined with third party - print ''; // Country - print ''; @@ -488,7 +488,7 @@ else // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; } - + // Visibility print ''; - print ''; print ''; @@ -680,13 +680,13 @@ else print ''; // Zip / Town - print ''; // Country - print ''; @@ -694,7 +694,7 @@ else // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; } @@ -731,13 +731,13 @@ else print ''; } print ''; - + // Skype if (! empty($conf->skype->enabled)) { print ''; } - + // Visibility print ''; } print ''; - + // Skype if (!empty($conf->skype->enabled)) { diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 78276c27885..db39f7bab86 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -259,6 +259,12 @@ class Interfaces $modName = $modules[$key]; if (empty($modName)) continue; + if (! class_exists($modName)) + { + print 'Error: A trigger file was found but its class "'.$modName.'" was not found.'."
\n"; + continue; + } + $objMod = new $modName($this->db); // Define disabledbyname and disabledbymodule diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 93fa8b70a84..97169393376 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -99,7 +99,7 @@ function checkBanForAccount($account) if (empty($account->number)) $account->number=$account->num_compte; if (empty($account->cle)) $account->cle=$account->cle_rib; - dol_syslog("Bank.lib::checkBanForAccount account->code_banque=".$account->code_banque." account->code_guichet=".$account->code_guichet." account->number=".$account->number." account->cle=".$account->cle." account->iban=".$account->iban." country_code=".$country_code, LOG_DEBUG); + dol_syslog("bank.lib::checkBanForAccount account->code_banque=".$account->code_banque." account->code_guichet=".$account->code_guichet." account->number=".$account->number." account->cle=".$account->cle." account->iban=".$account->iban." country_code=".$country_code, LOG_DEBUG); if ($country_code == 'FR') // France rules { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3b61a3150b5..134d6d408ab 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -957,7 +957,17 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) { if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; + + //Manage HTML entities description test + //Cause $prodser->description is store with htmlentities but $desc no + $needdesctranslation=false; + if (!empty($desc) && dol_textishtml($desc) && !empty($prodser->description) && dol_textishtml($prodser->description)) { + $needdesctranslation=(strpos(dol_html_entity_decode($desc,ENT_QUOTES | ENT_HTML401),dol_html_entity_decode($prodser->description,ENT_QUOTES | ENT_HTML401))!==false); + } else { + $needdesctranslation=($desc == $prodser->description); + } + + if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($needdesctranslation)) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 39178ab3874..bf9c98dc903 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -288,7 +288,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) $var=!$var; print '
'.$langs->trans("Name").'
'; -print ''; +print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; } else { + print ''; print ''; } -print ''; -print ''; +print ''; print "
'.$obj->name.''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; } else { + print ''; print ''; } - print ''; if ($conf->use_javascript_ajax) { print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index ec8399e0a35..bb17d1b039e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1316,9 +1316,9 @@ function fieldList($fieldlist,$obj='',$tabname='') $size=''; if ($fieldlist[$field]=='libelle') $size='size="32" '; if ($fieldlist[$field]=='tracking') $size='size="92" '; - if ($fieldlist[$field]=='accountancy_code') $size='size="15" '; - if ($fieldlist[$field]=='accountancy_code_sell') $size='size="15" '; - if ($fieldlist[$field]=='accountancy_code_buy') $size='size="15" '; + if ($fieldlist[$field]=='accountancy_code') $size='size="10" '; + if ($fieldlist[$field]=='accountancy_code_sell') $size='size="10" '; + if ($fieldlist[$field]=='accountancy_code_buy') $size='size="10" '; print ''; print '
'.$langs->trans("Company").''; + print ''; print $objsoc->getNomUrl(1); print '
'.$langs->trans("Company").''; + print '
'.$langs->trans("Company").''; print $form->select_company($socid,'socid','',1); print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans("Country").''; + print '
'.$langs->trans("Country").''; print $form->select_country((isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('State').''; + print '
'.$langs->trans('State').''; if ($object->country_id) { print $formcompany->select_state(isset($_POST["state_id"])?$_POST["state_id"]:$object->state_id,$object->country_code,'state_id'); @@ -527,10 +527,10 @@ else // Skype if (! empty($conf->skype->enabled)) - { + { print '
'.$langs->trans("Skype").'skype).'">
'.$langs->trans("ContactVisibility").''; $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); @@ -655,7 +655,7 @@ else if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { print '
'.$langs->trans("Company").''; + print ''; print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):($object->socid?$object->socid:-1),'socid','',1); print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans("Country").''; + print '
'.$langs->trans("Country").''; print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('State').''; + print '
'.$langs->trans('State').''; print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'state_id'); print '
 
'.$langs->trans("Skype").'skype).'">
'.$langs->trans("ContactVisibility").''; $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); @@ -950,7 +950,7 @@ else print ' 
'; - print ''; + print '
'; - } - - print ''; + print ''; $i++; - - if ($i % $thumbsbyrow == 0) print ''; } } } } } - if ($i % $thumbsbyrow != 0) - { - while ($i % $thumbsbyrow != 0) - { - print ''; - $i++; - } - print ''; - } - print '
'; $i=0; foreach($dirthemes as $dir) @@ -310,22 +310,15 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) // Disable not stable themes //if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/bureau2crea/i',$subdir)) continue; - if ($i % $thumbsbyrow == 0) - { - print '
'; + print '
'; $file=$dirtheme."/".$subdir."/thumb.png"; $url=$urltheme."/".$subdir."/thumb.png"; if (! file_exists($file)) $url=$urltheme."/common/nophoto.jpg"; - print '
'; print 'id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">'; if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive"); else $title=$langs->trans("ShowPreview"); - print ''.$title.''; - print ''; - print '
'; + print ''.$title.''; + print '
'; if ($subdir == $selected_theme) { print ' '.$subdir.''; @@ -334,27 +327,16 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) { print ' '.$subdir; } - print '
 
'; + print '
'; print ''; print ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1581af09a1d..230287420b5 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -627,7 +627,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/contact/fiche.php?leftmenu=contacts&action=create", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); - $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); if (! empty($conf->fournisseur->enabled)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("Others"), 2, $user->rights->societe->contact->lire); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); @@ -636,11 +636,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->categorie->enabled)) { $langs->load("categories"); - // Categories prospects/customers - $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + // Categories prospects/customers + $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + if (empty($user->societe_id)) + { + $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + } } // Categories Contact $newmenu->add("/categories/index.php?leftmenu=cat&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 08bd0e008ac..4e88c561306 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -178,10 +178,10 @@ class modFacture extends DolibarrModules $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("facture","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancyBuyCode'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancyBuyCode'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product'); + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product'); $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 33b98d56f48..c2c2ef9a452 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * This template needs: * $object */ @@ -47,77 +47,77 @@ $userstatic=new User($db);
- -
trans("Source"); ?>
-
trans("Company"); ?>
-
trans("Contacts"); ?>
-
trans("ContactType"); ?>
-
 
-
 
+ +
trans("Source"); ?>
+
trans("Company"); ?>
+
trans("Contacts"); ?>
+
trans("ContactType"); ?>
+
 
+
 
-
action="id; ?>" method="POST"> + " /> -
trans("Users"); ?>
-
global->MAIN_INFO_SOCIETE_NOM; ?>
-
select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56); ?>
-
selectTypeContact($object, '', 'type','internal'); ?>
-
 
-
">
+
trans("Users"); ?>
+
global->MAIN_INFO_SOCIETE_NOM; ?>
+
select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56); ?>
+
selectTypeContact($object, '', 'type','internal'); ?>
+
 
+
">
-
action="id; ?>" method="POST"> + " /> -
trans("ThirdPartyContacts"); ?>
+
trans("ThirdPartyContacts"); ?>
use_javascript_ajax && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { ?> -
+
'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); print $form->select_company($object->socid,'socid','',1,0,0,$events); ?>
-
+
select_contacts($object->socid, '', 'contactid'); ?>
-
+
socid; ?> selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany'); ?>
-
+
select_contacts($selectedCompany, '', 'contactid'); ?>
-
+
selectTypeContact($object, '', 'type','external'); ?>
-
 
-
+
 
+
">
-
-
trans("Source"); ?>
-
trans("Company"); ?>
-
trans("Contacts"); ?>
-
trans("ContactType"); ?>
-
trans("Status"); ?>
-
 
+ +
trans("Source"); ?>
+
trans("Company"); ?>
+
trans("Contacts"); ?>
+
trans("ContactType"); ?>
+
trans("Status"); ?>
+
 
@@ -132,12 +132,12 @@ $userstatic=new User($db); $var = !$var; ?> -
> -
+ "> +
trans("User"); ?> trans("ThirdPartyContact"); ?>
-
+
0) { @@ -154,7 +154,7 @@ $userstatic=new User($db); } ?>
-
+
-
-
+
+ -
+
 "> diff --git a/htdocs/ecm/ajax/ecmdatabase.php b/htdocs/ecm/ajax/ecmdatabase.php index 2609c402ffe..8461465c554 100644 --- a/htdocs/ecm/ajax/ecmdatabase.php +++ b/htdocs/ecm/ajax/ecmdatabase.php @@ -51,7 +51,9 @@ if (isset($action) && ! empty($action)) require DOL_DOCUMENT_ROOT . '/ecm/class/ecmdirectory.class.php'; $ecmdirstatic = new EcmDirectory($db); + $ecmdirtmp = new EcmDirectory($db); + // This part of code is same than into file index.php for action refreshmanual TODO Remove duplicate clearstatcache(); $diroutputslash=str_replace('\\', '/', $conf->$element->dir_output); @@ -129,7 +131,6 @@ if (isset($action) && ! empty($action)) if ($fk_parent >= 0) { - $ecmdirtmp=new EcmDirectory($db); $ecmdirtmp->ref = 'NOTUSEDYET'; $ecmdirtmp->label = dol_basename($dirdesc['fullname']); $ecmdirtmp->description = ''; @@ -163,7 +164,21 @@ if (isset($action) && ! empty($action)) } } + // Loop now on each sql tree to check if dir exists + foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk + { + $dirtotest=$conf->$element->dir_output.'/'.$dirdesc['fullrelativename']; + if (! dol_is_dir($dirtotest)) + { + $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; + $ecmdirtmp->id=$dirdesc['id']; + $ecmdirtmp->delete($user,'databaseonly'); + //exit; + } + } + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" + dol_syslog("sql = ".$sql); $db->query($sql); } } diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 4abeea326e4..54e3fa0a561 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -151,7 +151,7 @@ class EcmDirectory // extends CommonObject $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath(); $result=dol_mkdir($dir); if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; } - + // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); @@ -325,21 +325,23 @@ class EcmDirectory // extends CommonObject /** - * Delete object on database and on disk + * Delete object on database and/or on disk * * @param User $user User that delete + * @param int $mode 'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented) * @return int <0 if KO, >0 if OK */ - function delete($user) + function delete($user, $mode='all') { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; + $result=0; - $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 + if ($mode != 'databaseonly') $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 - dol_syslog(get_class($this)."::delete remove directory ".$relativepath); + dol_syslog(get_class($this)."::delete remove directory id=".$this->id." mode=".$mode.(($mode == 'databaseonly')?'':' relativepath='.$relativepath)); $this->db->begin(); @@ -356,8 +358,11 @@ class EcmDirectory // extends CommonObject return -2; } - $file = $conf->ecm->dir_output . "/" . $relativepath; - $result=@dol_delete_dir($file); + if ($mode != 'databaseonly') + { + $file = $conf->ecm->dir_output . "/" . $relativepath; + $result=@dol_delete_dir($file); + } if ($result || ! @is_dir(dol_osencode($file))) { diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 531138aaab9..e7e4498f99d 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -206,7 +206,10 @@ if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') // Refresh directory view if ($action == 'refreshmanual') { - clearstatcache(); + $ecmdirtmp = new EcmDirectory($db); + + // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate + clearstatcache(); $diroutputslash=str_replace('\\','/',$conf->ecm->dir_output); $diroutputslash.='/'; @@ -269,7 +272,7 @@ if ($action == 'refreshmanual') //break; // We found parent, we can stop the while loop } else - { + { dol_syslog("No"); //print "No
\n"; } @@ -282,7 +285,6 @@ if ($action == 'refreshmanual') if ($fk_parent >= 0) { - $ecmdirtmp=new EcmDirectory($db); $ecmdirtmp->ref = 'NOTUSEDYET'; $ecmdirtmp->label = dol_basename($dirdesc['fullname']); $ecmdirtmp->description = ''; @@ -316,6 +318,19 @@ if ($action == 'refreshmanual') } } + // Loop now on each sql tree to check if dir exists + foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk + { + $dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; + if (! dol_is_dir($dirtotest)) + { + $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; + $ecmdirtmp->id=$dirdesc['id']; + $ecmdirtmp->delete($user,'databaseonly'); + //exit; + } + } + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" dol_syslog("sql = ".$sql); $db->query($sql); diff --git a/htdocs/ecm/tpl/builddatabase.tpl.php b/htdocs/ecm/tpl/builddatabase.tpl.php index 4d5c0ab953a..1b34027142f 100644 --- a/htdocs/ecm/tpl/builddatabase.tpl.php +++ b/htdocs/ecm/tpl/builddatabase.tpl.php @@ -50,7 +50,15 @@ $(document).ready(function() { ); $('#refreshbutton').click( function() { - ecmBuildDatabase(); + $.pleaseBePatient("trans('PleaseBePatient'); ?>"); + $.getJSON( "", { + action: "build", + element: "ecm" + }, + function(response) { + $.unblockUI(); + location.href=""; + }); }); }); @@ -78,17 +86,5 @@ function loadandshowpreview(filedirname,section) }); } -ecmBuildDatabase = function() { - $.pleaseBePatient("trans('PleaseBePatient'); ?>"); - $.getJSON( "", { - action: "build", - element: "ecm" - }, - function(response) { - $.unblockUI(); - location.href=""; - }); -}; - - \ No newline at end of file + diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 1e09cd47482..9d2c8da6351 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -495,6 +495,7 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $product->fetch($objp->fk_product); + $product->load_stock(); } if ($objp->fk_product > 0 && $type == 0 && ! empty($conf->stock->enabled)) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 1aab076bf06..8c87e754bc4 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -369,7 +369,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) /* * Mise a jour d'une ligne dans la commande */ -else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer && $_POST['save'] == $langs->trans('Save')) +else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer && ! GETPOST('cancel')) { if ($_POST["elrowid"]) { diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index e56c60a68dd..bc4004e4fc1 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -109,16 +109,17 @@ if ($sttc) } if ($sall) { - $sql .= natural_search(array('cf.ref', 'cf.note_public'), $sall); + $sql .= natural_search(array('cf.ref', 'cf.note_public', 'cf.note_private'), $sall); } if ($socid) $sql.= " AND s.rowid = ".$socid; if (GETPOST('statut')) { - $sql .= " AND fk_statut =".GETPOST('statut'); + $sql .= " AND fk_statut =".GETPOST('statut','int'); } -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); +$sql.= " ORDER BY $sortfield $sortorder "; +$sql.= $db->plimit($conf->liste_limit+1, $offset); $resql = $db->query($sql); if ($resql) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 1423820f165..5bd2c698dce 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -53,6 +53,7 @@ Language_sl_SI=Slovenian Language_sv_SV=Swedish Language_sv_SE=Swedish Language_sk_SK=Slovakian +Language_uz_UZ=Uzbek Language_vi_VN=Vietnamese Language_zh_CN=Chinese Language_zh_TW=Chinese (Traditional) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7c535e07d5d..89b05f25f9a 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -257,6 +257,8 @@ Seconds=Seconds Today=Today Yesterday=Yesterday Tomorrow=Tomorrow +Morning=Morning +Afternoon=Afternoon Quadri=Quadri MonthOfDay=Month of the day HourShort=H diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 7aad675d0ba..4d55ae663e1 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -109,4 +109,5 @@ NbOfProductAfterPeriod=Quantity of product %s in stock after selected period (> MassStockMovement=Mass stock movement SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "%s". Once this is done for all required movements, click onto "%s". RecordMovement=Record transfert -ReceivingForSameOrder=Receivings for this order \ No newline at end of file +ReceivingForSameOrder=Receivings for this order +StockMovementRecorded=Stock movements recorded \ No newline at end of file diff --git a/htdocs/langs/fr_FR/languages.lang b/htdocs/langs/fr_FR/languages.lang index 651d303f502..86b7dd369ee 100644 --- a/htdocs/langs/fr_FR/languages.lang +++ b/htdocs/langs/fr_FR/languages.lang @@ -53,6 +53,7 @@ Language_sl_SI=Slovène Language_sv_SV=Suédois Language_sv_SE=Suédois Language_sk_SK=Slovaque +Language_uz_UZ=Ouzbek Language_vi_VN=Vietnamien Language_zh_CN=Chinois Language_zh_TW=Chinois (Traditionel) diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 5725292f70d..34b0da196a2 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -257,6 +257,8 @@ Seconds=Secondes Today=Aujourd'hui Yesterday=Hier Tomorrow=Demain +Morning=Matin +Afternoon=Après-midi Quadri=Trimestre MonthOfDay=Mois du jour HourShort=H diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index e9d896538af..ea61d1f4632 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -90,7 +90,7 @@ CalculatedVolume=Volume calculé Weight=Poids TotalWeight=Poids total WeightUnitton=tonnes -WeightUnitkg=Kg +WeightUnitkg=kg WeightUnitg=g WeightUnitmg=mg WeightUnitpound=livre diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index a39576f86f3..3af178c3f63 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -109,4 +109,5 @@ NbOfProductAfterPeriod=Quantité du produit %s en stock après la périod MassStockMovement=Mouvement de stock en masse SelectProductInAndOutWareHouse=Sélectionner un produit, une quantité à transférer, un entrepôt source et destination et cliquer sur "%s". Une fois tous les mouvements choisis, cliquer sur "%s". RecordMovement=Enregistrer transferts -ReceivingForSameOrder=Réceptions pour cette commande \ No newline at end of file +ReceivingForSameOrder=Réceptions pour cette commande +StockMovementRecorded=Mouvements de stock enregistrés \ No newline at end of file diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index 6d1ded03419..1ee6fd99e2a 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -90,15 +90,23 @@ function marges_prepare_head() * @param float $localtax2_tx Vat rate special 2 * @param int $fk_pa ??? * @param float $paht Buying price without tax + * @param int $type Type of line (product or service) + * @param Societe $seller Object of seller + * @param array $localtaxes_array Array of localtaxes * @return array Array of margin info + * + * FIXME This function is called too frequently without type, seller and without localtaxes_array defined. This make vat rate detection wrong. */ -function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht) +function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht, $type=0, $seller='', $localtaxes_array='') { - global $db, $conf; + global $db, $conf, $mysoc; $marge_tx_ret=''; $marque_tx_ret=''; + if (empty($seller) || ! is_object($seller)) $seller=$mysoc; + if (empty($localtaxes_array) || ! is_array($localtaxes_array)) $localtaxes_array=array(); + if($fk_pa > 0) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $product = new ProductFournisseur($db); @@ -115,7 +123,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // calcul pu_ht remisés - $tabprice=calcul_price_total(1, $pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 'HT', 0, 0); // FIXME Parameter type is missing, i put 0 to avoid blocking error + $tabprice=calcul_price_total(1, $pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 'HT', 0, $type, $seller, $localtaxes_array); $pu_ht_remise = $tabprice[0]; // calcul marge if ($pu_ht_remise < 0) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 2d3683abe6b..31ed9b97ff8 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -309,10 +309,10 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f } } } - + // For multicompany - $out.="&entity=".$conf->entity; - + //$out.="&entity=".$conf->entity; // This should not be into link. Link contains already a ref of an object that allow to retreive entity + return $out; } @@ -691,7 +691,7 @@ function hash_call($methodName,$nvpStr) curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?5:$conf->global->MAIN_USE_CONNECT_TIMEOUT); curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT); - + curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index aafe01bbb01..aa1a470aef1 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Laurent Destailleur * * 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 @@ -28,6 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $langs->load("admin"); $langs->load("products"); @@ -41,6 +43,7 @@ $newvatrate=GETPOST('newvatrate'); //$price_base_type=GETPOST('price_base_type'); $objectstatic = new Product($db); +$objectstatic2 = new ProductFournisseur($db); /* @@ -60,104 +63,176 @@ if ($action == 'convert') if (! $error) { + $country_id=$mysoc->country_id; // TODO Allow to choose country into form + + $nbrecordsmodified=0; + $db->begin(); - $sql = 'SELECT rowid'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'product'; - $sql.= ' WHERE entity IN ('.getEntity('product',1).')'; - $sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'"; - //$sql.= ' AND price_base_type = "'..'"'; - //print $sql; + // If country to edit is my country, so we change customer prices + if ($country_id == $mysoc->country_id) + { + $sql = 'SELECT rowid'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'product'; + $sql.= ' WHERE entity IN ('.getEntity('product',1).')'; + $sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'"; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + $ret=$objectstatic->fetch($obj->rowid); + if ($ret > 0) + { + $ret=0; $retm=0; $updatelevel1=false; + + // Update multiprice + $listofmulti=array_reverse($objectstatic->multiprices, true); // To finish with level 1 + foreach ($listofmulti as $level => $multiprices) + { + $price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update + if (empty($price_base_type)) continue; // Discard not defined price levels + + if ($price_base_type == 'TTC') + { + $newprice=price2num($objectstatic->multiprices_ttc[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->multiprices_min_ttc[$level]; + } + else + { + $newprice=price2num($objectstatic->multiprices[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->multiprices_min[$level]; + } + if ($newminprice > $newprice) $newminprice=$newprice; + $newvat=str_replace('*','',$newvatrate); + $newnpr=$objectstatic->multiprices_recuperableonly[$level]; + $newlevel=$level; + + //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + if ($retm < 0) + { + $error++; + break; + } + + if ($newlevel == 1) $updatelevel1=true; + } + + // Update single price + $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update + if ($price_base_type == 'TTC') + { + $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min_ttc; + } + else + { + $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min; + } + if ($newminprice > $newprice) $newminprice=$newprice; + $newvat=str_replace('*','',$newvatrate); + $newnpr=$objectstatic->recuperableonly; + $newlevel=0; + if (! empty($price_base_type) && ! $updatelevel1) + { + //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + } + + if ($ret < 0 || $retm < 0) $error++; + else $nbrecordsmodified++; + } + + $i++; + } + } + else dol_print_error($db); + } + + $fourn = new Fournisseur($db); + + // Change supplier prices + $sql = 'SELECT pfp.rowid, pfp.fk_soc, pfp.price as price, pfp.quantity as qty, pfp.fk_availability, pfp.ref_fourn'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp, '.MAIN_DB_PREFIX.'societe as s'; + $sql.= ' WHERE pfp.fk_soc = s.rowid AND pfp.entity IN ('.getEntity('product',1).')'; + $sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'"; + $sql.= " AND s.fk_pays = '".$country_id."'"; + //print $sql; $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $i = 0; $nbrecordsmodified=0; + $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); - $ret=$objectstatic->fetch($obj->rowid); + $ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid); if ($ret > 0) { $ret=0; $retm=0; $updatelevel1=false; - // Update multiprice - $listofmulti=array_reverse($objectstatic->multiprices, true); // To finish with level 1 - foreach ($listofmulti as $level => $multiprices) - { - $price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update - if (empty($price_base_type)) continue; // Discard not defined price levels - - if ($price_base_type == 'TTC') - { - $newprice=price2num($objectstatic->multiprices_ttc[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->multiprices_min_ttc[$level]; - } - else - { - $newprice=price2num($objectstatic->multiprices[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->multiprices_min[$level]; - } - if ($newminprice > $newprice) $newminprice=$newprice; - $newvat=str_replace('*','',$newvatrate); - $newnpr=$objectstatic->multiprices_recuperableonly[$level]; - $newlevel=$level; - - //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); - if ($retm < 0) - { - $error++; - break; - } - - if ($newlevel == 1) $updatelevel1=true; - } - - // Update single price - $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update - if ($price_base_type == 'TTC') - { - $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->price_min_ttc; - } - else - { - $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->price_min; - } - if ($newminprice > $newprice) $newminprice=$newprice; + $price_base_type='HT'; + //$price_base_type = $objectstatic2->price_base_type; // Get price_base_type of product/service to keep the same for update + //if ($price_base_type == 'TTC') + //{ + // $newprice=price2num($objectstatic2->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + // $newminprice=$objectstatic2->price_min_ttc; + //} + //else + //{ + $newprice=price2num($obj->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + //$newminprice=$objectstatic2->fourn_price_min; + //} + //if ($newminprice > $newprice) $newminprice=$newprice; $newvat=str_replace('*','',$newvatrate); - $newnpr=$objectstatic->recuperableonly; + //$newnpr=$objectstatic2->recuperableonly; $newlevel=0; if (! empty($price_base_type) && ! $updatelevel1) { - //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + //print "$objectstatic2->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $fourn->id=$obj->fk_soc; + $ret=$objectstatic2->update_buyprice($obj->qty, $newprice, $user, $price_base_type, $fourn, $obj->fk_availability, $obj->ref_fourn, $newvat); } if ($ret < 0 || $retm < 0) $error++; else $nbrecordsmodified++; } - $i++; } - - if (! $error) - { - if ($nbrecordsmodified > 0) setEventMessage($langs->trans("RecordsModified",$nbrecordsmodified)); - else setEventMessage($langs->trans("NoRecordFound"),'warnings'); - $db->commit(); - } - else - { - setEventMessage($langs->trans("Error"),'errors'); - $db->rollback(); - } } + else dol_print_error($db); + + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } + + // Output result + if (! $error) + { + if ($nbrecordsmodified > 0) setEventMessage($langs->trans("RecordsModified",$nbrecordsmodified)); + else setEventMessage($langs->trans("NoRecordFound"),'warnings'); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } + } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8a6745da13f..4fa56c35a55 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1151,7 +1151,7 @@ class Product extends CommonObject $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; $sql.= " datec, tms, import_key, entity, desiredstock"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; - if ($id) $sql.= " WHERE rowid = '".$id."'"; + if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id); else { $sql.= " WHERE entity IN (".getEntity($this->element, 1).")"; @@ -1224,6 +1224,7 @@ class Product extends CommonObject $this->db->free($resql); + // multilangs if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); @@ -1347,9 +1348,11 @@ class Product extends CommonObject } } - $res=$this->load_stock(); - - return $res; + // We should not load stock at each fetch. If someone need stock, he must call load_stock after fetch. + //$res=$this->load_stock(); + //return $res; + + return 1; } else { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index d65da9d7851..e98ce39bfe9 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent @@ -99,6 +99,11 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); $tva_tx = price2num($tva_tx); + if ($tva_tx == '') + { + $error++; + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")).'
'; + } if (empty($quantity)) { $error++; @@ -353,6 +358,7 @@ if ($id || $ref) if (! empty($socid)) // When update { $default_vat=get_default_tva($supplier, $mysoc, $product->id); + if (empty($default_vat)) $default_vat=$product->tva_tx; } print ''; print ''; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 6e4ada58b34..2652c7c45bd 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -81,7 +81,8 @@ class MouvementStock dol_print_error('',"Failed to fetch product"); return -1; } - + $product->load_stock(); + // Define if we must make the stock change (If product type is a service or if stock is used also for services) $movestock=0; if ($product->type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock=1; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 10ada810276..153356d969f 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -207,9 +207,9 @@ $formproduct=new FormProduct($db); if ($id > 0 || $ref) { $product = new Product($db); - if ($ref) $result = $product->fetch('',$ref); - if ($id > 0) $result = $product->fetch($id); - + $result = $product->fetch($id,$ref); + $product->load_stock(); + $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("CardProduct".$product->type),$help_url); diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 730e0e954fb..6668f6f7276 100644 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -29,12 +29,10 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. -// For MultiCompany module -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); -if (is_int($entity)) -{ - define("DOLENTITY", $entity); -} +// For MultiCompany module. This should be useless. Because entity must be retreive from object ref and not from url. +$entity=GETPOST('entity')?GETPOST('entity','int'):1; +if (is_int($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 35dc64d377c..40d4f916b40 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -29,12 +29,10 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. -// For MultiCompany module -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); -if (is_int($entity)) -{ - define("DOLENTITY", $entity); -} +// For MultiCompany module. This should be useless. Because entity must be retreive from object ref and not from url. +$entity=GETPOST('entity')?GETPOST('entity','int'):1; +if (is_int($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 7229c0cda9d..fb8274e5524 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -44,48 +44,68 @@ This page is a sample of page using tables. To make test with

-Example 0 : Table with div and table with table containg a select that should be overflowed and truncated
-
- -
-
- - + +
+ +
+ + +Example 0b: Table with div+form+div containg a select that should be overflowed and truncated
+
+ +
+ +
+
+ +
+ +
+Example 0c: Table with table+tr+td containg a select that should be overflowed and truncated
+
+Example 0a : Table with div+div+div containg a select that should be overflowed and truncated
+
+
+
-
+ + + +
+ + + +

-Example 1 : Table using tags: div.tagtable+form+div or div.tagtable+div.tagtr+div.tagtd
+Example 1 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd
use_javascript_ajax) && $object->statut == 0) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; ?> - - -
-
-
line3
-
dfsdf
-
ffdsfsd
-
aaaa
+
+
line3
+
dfsdf
+
ffdsfsd
+
aaaa
-
line4
-
dfsdf
-
-
bbbb
+
line4
+
dfsdf
+
+
bbbb
-
line5
-
dfsdf
-
-
bbbb
+
line5
+
dfsdf
+
+
bbbb