diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f73b4917d78..7a9e2301191 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2056,7 +2056,7 @@ class Propal extends CommonObject { // We remove directory $ref = dol_sanitizeFileName($this->ref); - if ($conf->propal->dir_output) + if ($conf->propal->dir_output && !empty($this->ref)) { $dir = $conf->propal->dir_output . "/" . $ref ; $file = $dir . "/" . $ref . ".pdf"; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2341f5e4ff7..5566ce4d90d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2457,7 +2457,7 @@ class Commande extends CommonOrder // On efface le repertoire de pdf provisoire $comref = dol_sanitizeFileName($this->ref); - if ($conf->commande->dir_output) + if ($conf->commande->dir_output && !empty($this->ref)) { $dir = $conf->commande->dir_output . "/" . $comref ; $file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 521a8f63e80..53adade47ab 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1323,7 +1323,7 @@ class Facture extends CommonInvoice { // On efface le repertoire de pdf provisoire $ref = dol_sanitizeFileName($this->ref); - if ($conf->facture->dir_output) + if ($conf->facture->dir_output && !empty($this->ref)) { $dir = $conf->facture->dir_output . "/" . $ref; $file = $conf->facture->dir_output . "/" . $ref . "/" . $ref . ".pdf"; diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index a368561d8af..de21a157c74 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -49,8 +49,12 @@ function tax_prepare_head($object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'tax'); + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); + $nbFiles = count(dol_dir_list($upload_dir,'files')); $head[$h][0] = DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); + if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; $head[$h][2] = 'documents'; $h++; diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index b9c5d89a72e..07c568d41fc 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -168,6 +168,15 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest) { dol_syslog("functions_ldap::check_user_password_ldap Sync user found id=".$user->id); // On verifie si le login a change et on met a jour les attributs dolibarr + + if ($conf->multicompany->enabled) { + global $mc; + + $ret=$mc->checkRight($user->id, $entitytotest); + if ($ret < 0) $login=false; // provoque l'echec de l'identification + } + + if ($user->login != $ldap->login && $ldap->login) { $user->login = $ldap->login; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 5ac8438f2ad..dba0d7c8acc 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -701,38 +701,37 @@ elseif ($action == 'update_extras') // Fill array 'array_options' with data from add form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - - if($ret < 0) - $error++; - - if(!$error) { - + + if($ret < 0) $error++; + + if (!$error) + { // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('supplierorderdao')); $parameters=array('id'=>$object->id); - + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - + if (empty($reshook)) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - + $result=$object->insertExtraFields(); - + if ($result < 0) { $error++; } - + } } else if ($reshook < 0) $error++; } else { - $action = 'edit_extras'; + $action = 'edit_extras'; } } @@ -1119,12 +1118,12 @@ if ($action=="create") // Other options $parameters=array(); $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)) { print $object->showOptionals($extrafields,'edit'); } - + // Bouton "Create Draft" print "\n"; @@ -1141,9 +1140,9 @@ elseif (! empty($object->id)) $title=$langs->trans("SupplierOrder"); dol_fiche_head($head, 'card', $title, 0, 'order'); - + $res=$object->fetch_optionals($object->id,$extralabels); - + /* * Confirmation de la suppression de la commande */ @@ -1408,7 +1407,6 @@ elseif (! empty($object->id)) // Other attributes $parameters=array('socid'=>$socid, '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)) { if ($action == 'edit_extras') @@ -1418,7 +1416,7 @@ elseif (! empty($object->id)) print ''; print ''; } - + foreach($extrafields->attribute_label as $key=>$label) { if ($action == 'edit_extras') { @@ -1426,7 +1424,7 @@ elseif (! empty($object->id)) } else { $value=$object->array_options["options_".$key]; } - + if ($extrafields->attribute_type[$key] == 'separate') { print $extrafields->showSeparator($key); @@ -1441,7 +1439,7 @@ elseif (! empty($object->id)) { $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]); } - + if ($action == 'edit_extras' && $user->rights->fournisseur->commande->creer) { print $extrafields->showInputField($key,$value); @@ -1450,12 +1448,13 @@ elseif (! empty($object->id)) { print $extrafields->showOutputField($key,$value); } - + print ''."\n"; } } - if(count($extrafields->attribute_label) > 0) { + if(count($extrafields->attribute_label) > 0) + { if ($action == 'edit_extras' && $user->rights->fournisseur->commande->creer) { print '