Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2012-09-04 17:48:33 +02:00
commit 2bf933fbab
78 changed files with 1658 additions and 809 deletions

View File

@ -30,6 +30,7 @@ jQuery FileUpload 5.0.3 GPL and MIT Licence Yes JS library to upload files
jQuery JCrop 0.9.8 GPL and MIT Licence Yes JS library plugin Crop (to crop images)
jQuery jeditable 1.7.1 GPL and MIT Licence Yes JS library plugin jeditable (to edit in place)
jQuery jNotify 1.1.00 Apache Software License 2.0 No (GPLv3 only) JS library plugin jNotify (to use ajax popups)
jQuery blockUI 2.43 GPL and MIT Licence Yes JS library plugin blockUI (to use ajax popups)
jQuery jPicker 1.1.00 GPL and MIT Licence Yes JS library for color picker with not defined list of colors
jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.15)
jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows)

View File

@ -3,7 +3,7 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 3.3 compared to 3.2.1 *****
***** ChangeLog for 3.3 compared to 3.2.2 *****
For users:
- New: If field "signature" is filled into user table, text is added
at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this
@ -42,6 +42,7 @@ For users:
- New: Can select thirdparties into emailing targets, even if module category is not enabled.
- New: [ task #498 ] Improvement of the block to add products/services lines.
- New: Add margin and commissions management module.
- New: ECM autodir works also for files joined to products and services.
- Fix: [ bug #499 ]: Supplier order input method not translated
- Fix: No images into product description lines as PDF generation does
not work with this.
@ -70,6 +71,11 @@ For translators:
***** ChangeLog for 3.2.2 compared to 3.2.1 *****
Fix: Modify spanish VAT to new rates
***** ChangeLog for 3.2.1 compared to 3.2.0 *****
- Fix: Edit of projects.
- Fix: Activation of modules does not fails if directory install was removed.

View File

@ -0,0 +1,7 @@
# DOLIWAMP, THE DOLIBARR INSTALLER FOR WINDOWS
DoliWamp is a special all in one package installer for Windows (Dolibarr+Mysql+Apache+PHP).
It's a dedicated Dolibarr version for Windows newbies with no technical knowledge. This package will install or upgrade Dolibarr but also and all prerequisites like the web server, and the database in one autoinstall process.
If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr or want to use Dolibarr other components (PostgreSQL), you should not use this assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (.tgz or .zip file).

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -95,7 +95,7 @@ print "</tr>";
print "<tr class=\"impair\">";
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_XCAL_EXPORTKEY\" value=\"". (GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha'):$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . "\" size=\"40\"></td>";
print "<td><input required=\"required\" type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_XCAL_EXPORTKEY\" value=\"". (GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha'):$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . "\" size=\"40\"></td>";
print "<td>&nbsp;</td>";
print "</tr>";

View File

@ -517,49 +517,6 @@ print "<td>&nbsp;</td>\n";
print "</tr>\n";
$var=true;
// Valider la commande apres cloture de la propale
// permet de na pas passer par l'option commande provisoire
/*
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setvalidorder">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ValidOrderAfterPropalClosed").'</td>';
print '<td width="60" align="center">'.$form->selectyesno("validorder",$conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL,1).'</td>';
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</form>';
*/
// Ajouter une ligne de frais port indiquant le poids de la commande
/*
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="deliverycostline">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("AddDeliveryCostLine").'</td>';
print '<td width="60" align="center">'.$form->selectyesno("addline",$conf->global->COMMANDE_ADD_DELIVERY_COST_LINE,1).'</td>';
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</form>';
*/
// Utiliser le contact de la commande dans le document
/*
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_use_customer_contact_as_recipient">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("UseCustomerContactAsOrderRecipientIfExist").'</td>';
print '<td width="60" align="center">'.$form->selectyesno("use_customer_contact_as_recipient",$conf->global->COMMANDE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1).'</td>';
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</form>';
*/
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -103,7 +103,7 @@ print '<input type="hidden" name="action" value="setvalue">';
$var=true;
print '<table class="nobordernopadding" width="100%">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
@ -123,7 +123,7 @@ print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail"));
print '</td></tr>';
// TODO the precedent values are deleted after turn on this switch
// TODO the precedent values are deleted after turn on this switch
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("ActivateCheckRead").'</td><td>';
@ -149,12 +149,12 @@ print $langs->trans("ActivateCheckReadKey").'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" '.$readonly.' value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
print '</td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table></form>';
$db->close();
print '<br>';
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
llxFooter();
$db->close();
?>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -24,13 +24,17 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load("users");
$langs->load("admin");
$langs->load("other");
if (!$user->admin) accessforbidden();
if (! $user->admin)
accessforbidden();
$action=GETPOST('action','alpha');
$upload_dir=$conf->admin->dir_temp;
@ -43,65 +47,75 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_add_file_process($upload_dir,0,0);
dol_add_file_process($upload_dir, 0, 0, 'userfile');
}
if ($_GET["action"] == 'activate_captcha')
if (preg_match('/set_(.*)/',$action,$reg))
{
dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity);
header("Location: security_other.php");
exit;
}
else if ($_GET["action"] == 'disable_captcha')
{
dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity);
header("Location: security_other.php");
exit;
$code=$reg[1];
$value=(GETPOST($code) ? GETPOST($code) : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if ($_GET["action"] == 'activate_advancedperms')
else if (preg_match('/del_(.*)/',$action,$reg))
{
dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity);
header("Location: security_other.php");
exit;
}
else if ($_GET["action"] == 'disable_advancedperms')
{
dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity);
header("Location: security_other.php");
exit;
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT')
else if ($action == 'MAIN_SESSION_TIMEOUT')
{
if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully");
}
if ($_GET["action"] == 'MAIN_UPLOAD_DOC')
else if ($action == 'MAIN_UPLOAD_DOC')
{
if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully");
}
if ($_GET["action"] == 'MAIN_UMASK')
else if ($action == 'MAIN_UMASK')
{
if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully");
}
if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND')
else if ($action == 'MAIN_ANTIVIRUS_COMMAND')
{
if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully");
}
if ($_GET["action"] == 'MAIN_ANTIVIRUS_PARAM')
else if ($action == 'MAIN_ANTIVIRUS_PARAM')
{
if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully");
}
// Delete file
else if ($action == 'delete')
{
$langs->load("other");
$file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"]);
exit;
}
/*
* View
@ -168,14 +182,21 @@ print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
print '<td align="right">';
if (function_exists("imagecreatefrompng"))
{
if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0)
{
print '<a href="security_other.php?action=activate_captcha">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1)
{
print '<a href="security_other.php?action=disable_captcha">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
}
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA');
}
else
{
if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
}
}
else
{
@ -183,35 +204,34 @@ else
$desc = $form->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning');
print $desc;
}
print "</td>";
print "</td>";
print '</tr>';
print '</td></tr>';
// Enable advanced perms
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
print '<td align="right">';
if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0)
if (! empty($conf->use_javascript_ajax))
{
print '<a href="security_other.php?action=activate_advancedperms">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS');
}
if($conf->global->MAIN_USE_ADVANCED_PERMS == 1)
else
{
print '<a href="security_other.php?action=disable_advancedperms">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_USE_ADVANCED_PERMS">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_USE_ADVANCED_PERMS">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
}
print "</td>";
print "</td>";
print '</tr>';
print "</td></tr>";
print '</table>';
print '<br>';
// Upload options
$var=false;
@ -274,7 +294,7 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
}
}
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND).'">';
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)?dol_htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND):'').'">';
print "</td>";
print '<td align="right">';
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
@ -291,7 +311,7 @@ print '<td colspan="2">'.$langs->trans("AntiVirusParam").'<br>';
print $langs->trans("AntiVirusParamExample");
print '</td>';
print '<td>';
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size="72" value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM).'">';
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size="72" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_PARAM)?dol_htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM):'').'">';
print "</td>";
print '<td align="right">';
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
@ -301,19 +321,16 @@ print '</form>';
print '</table>';
print '</div>';
// Form to test upload
dol_htmloutput_mesg($mesg);
// Affiche formulaire upload
print '<br>';
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/admin/security_other.php',$langs->trans("FormToTestFileUploadForm"),0,0,1);
$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1);
// List of document
$filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1);
$formfile->list_of_documents($filearray, '', 'admin_temp', '');
llxFooter();
$db->close();
?>

View File

@ -120,11 +120,11 @@ class ActionComm extends CommonObject
if (empty($this->punctual)) $this->punctual = 0;
if ($this->percentage > 100) $this->percentage = 100;
if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
if ($this->datep && $this->datef) $this->durationp=($this->datef - $this->datep);
if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date);
if ($this->datep && $this->datef && $this->datep > $this->datef) $this->datef=$this->datep;
if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date;
if ($this->fk_project < 0) $this->fk_project = 0;
if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep);
if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date);
if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep;
if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date;
if (! isset($this->fk_project) || $this->fk_project < 0) $this->fk_project = 0;
if ($this->elementtype=='facture') $this->elementtype='invoice';
if ($this->elementtype=='commande') $this->elementtype='order';
if ($this->elementtype=='contrat') $this->elementtype='contract';
@ -186,19 +186,19 @@ class ActionComm extends CommonObject
$sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").",";
//$sql.= (strval($this->date)!=''?"'".$this->db->idate($this->date)."'":"null").",";
//$sql.= (strval($this->dateend)!=''?"'".$this->db->idate($this->dateend)."'":"null").",";
$sql.= ($this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").",";
$sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").",";
//$sql.= ($this->durationa >= 0 && $this->durationa != ''?"'".$this->durationa."'":"null").",";
$sql.= " '".$this->type_id."',";
$sql.= ($this->societe->id>0?" '".$this->societe->id."'":"null").",";
$sql.= ($this->fk_project>0?" '".$this->fk_project."'":"null").",";
$sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").",";
$sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").",";
$sql.= " '".$this->db->escape($this->note)."',";
$sql.= ($this->contact->id > 0?"'".$this->contact->id."'":"null").",";
$sql.= ($user->id > 0 ? "'".$user->id."'":"null").",";
$sql.= ($this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").",";
$sql.= ($this->userdone->id > 0?"'".$this->userdone->id."'":"null").",";
$sql.= (isset($this->contact->id) && $this->contact->id > 0?"'".$this->contact->id."'":"null").",";
$sql.= (isset($user->id) && $user->id > 0 ? "'".$user->id."'":"null").",";
$sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").",";
$sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").",";
$sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',";
$sql.= ($this->fk_element?$this->fk_element:"null").",";
$sql.= ($this->elementtype?"'".$this->elementtype."'":"null").",";
$sql.= (! empty($this->fk_element)?$this->fk_element:"null").",";
$sql.= (! empty($this->elementtype)?"'".$this->elementtype."'":"null").",";
$sql.= $conf->entity;
$sql.= ")";

View File

@ -93,13 +93,14 @@ if ($action == 'add_action')
}
$fulldayevent=GETPOST('fullday');
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters
$datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
$datef=dol_mktime($fulldayevent?'23':$_POST["p2hour"], $fulldayevent?'59':$_POST["p2min"], $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
// Check parameters
if (! $datef && GETPOST('percentage') == 100)
if (! $datef && $percentage == 100)
{
$error++;
$action = 'create';
@ -143,7 +144,7 @@ if ($action == 'add_action')
$actioncomm->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0;
$actioncomm->datep = $datep;
$actioncomm->datef = $datef;
$actioncomm->percentage = isset($_POST["percentage"])?$_POST["percentage"]:0;
$actioncomm->percentage = $percentage;
$actioncomm->duree=((GETPOST('dureehour') * 60) + GETPOST('dureemin')) * 60;
$usertodo=new User($db);
@ -266,7 +267,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
}
/*
* Action mise a jour de l'action
* Action update event
*/
if ($action == 'update')
{
@ -277,14 +278,13 @@ if ($action == 'update')
$apmin=GETPOST('apmin');
$p2hour=GETPOST('p2hour');
$p2min=GETPOST('p2min');
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters
if ($aphour == -1) $aphour='0';
if ($apmin == -1) $apmin='0';
if ($p2hour == -1) $p2hour='0';
if ($p2min == -1) $p2min='0';
//if ($_POST["adhour"] == -1) $_POST["adhour"]='0';
//if ($_POST["admin"] == -1) $_POST["admin"]='0';
$actioncomm = new Actioncomm($db);
$actioncomm->fetch($id);
@ -295,9 +295,7 @@ if ($action == 'update')
$actioncomm->label = $_POST["label"];
$actioncomm->datep = $datep;
$actioncomm->datef = $datef;
//$actioncomm->date = $datea;
//$actioncomm->dateend = $datea2;
$actioncomm->percentage = $_POST["percentage"];
$actioncomm->percentage = $percentage;
$actioncomm->priority = $_POST["priority"];
$actioncomm->fulldayevent= $_POST["fullday"]?1:0;
$actioncomm->location = isset($_POST["location"])?$_POST["location"]:'';
@ -307,7 +305,7 @@ if ($action == 'update')
$actioncomm->note = $_POST["note"];
$actioncomm->pnote = $_POST["note"];
if (! $datef && $_POST["percentage"] == 100)
if (! $datef && $percentage == 100)
{
$error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd"));
$action = 'edit';
@ -809,7 +807,7 @@ if ($id)
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -272,7 +272,7 @@ if ($socid > 0)
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">&nbsp;'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>';
print $form->load_tva('tva_tx',GETPOST('tva_tx'),'',$mysoc,'');
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$objsoc);
print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';

View File

@ -1688,7 +1688,7 @@ class Facture extends CommonInvoice
$result=$this->client->set_as_client();
// Si active on decremente le produit principal et ses composants a la validation de facture
if ($this->type != 3 && $result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL)
if ($this->type != 3 && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");

View File

@ -61,8 +61,8 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
$result=$ecmdir->fetch($section);
if (! $result > 0)
{
dol_print_error($db,$ecmdir->error);
exit;
//dol_print_error($db,$ecmdir->error);
//exit;
}
}
else // For no ajax call
@ -223,6 +223,16 @@ if ($type == 'directory')
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
}
else if ($module == 'product') // Auto area for products
{
$upload_dir = $conf->product->dir_output;
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$param.='&module='.$module;
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
}
else if ($module == 'tax') // Auto area for suppliers invoices
{
$upload_dir = $conf->tax->dir_output;

View File

@ -78,7 +78,7 @@ $userstatic=new User($db);
$form=new Form($db);
$ecmdirstatic = new EcmDirectory($db);
// Load full tree. We will use it to define nbofsubdir and nboffilesinsubdir
// Load full tree from database. We will use it to define nbofsubdir and nboffilesinsubdir
if (empty($sqltree)) $sqltree=$ecmdirstatic->get_full_arbo(0);
// Try to find key into $sqltree
@ -93,13 +93,13 @@ foreach($sqltree as $keycursor => $val)
}
if( file_exists($fullpathselecteddir) )
if (file_exists($fullpathselecteddir))
{
$files = @scandir($fullpathselecteddir);
if ($files)
{
natcasesort($files);
if( count($files) > 2 ) /* The 2 accounts for . and .. */
if ( count($files) > 2 ) /* The 2 accounts for . and .. */
{
echo "<ul class=\"ecmjqft\" style=\"display: none;\">\n";
@ -111,16 +111,27 @@ if( file_exists($fullpathselecteddir) )
$nbofsubdir=0;
$nboffilesinsubdir=0;
// Try to find key into $sqltree
$val=array();
// Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan
foreach($sqltree as $key => $tmpval)
{
//print "-- ".$val['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file).'<br>';
if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file))
//print "-- key=".$key." - ".$val['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file).'<br>';
if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database
{
$val=$tmpval;
$resarray=tree_showpad($sqltree,$key,1);
$resarray=tree_showpad($sqltree,$key,1);
// Refresh cache for this subdir
if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t
{
$result=$ecmdirstatic->fetch($val['id']);
$ecmdirstatic->ref=$ecmdirstatic->label;
$result=$ecmdirstatic->refreshcachenboffile(0);
$val['cachenbofdoc']=$result;
}
$a=$resarray[0];
$nbofsubdir=$resarray[1];
$nboffilesinsubdir=$resarray[2];
@ -128,10 +139,18 @@ if( file_exists($fullpathselecteddir) )
}
}
//if (file_exists($fullpathselecteddir . $file) && $file != '.' && $file != '..' && is_dir($fullpathselecteddir . $file))
if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . $file)))
//print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . (preg_match('/\/$/',$fullpathselecteddir)?'':'/') . $file)))
{
print '<li class="directory collapsed">';
if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
{
$val['fullrelativename']=$file; $val['id']=0;
$val['label']=$file;
$val['description']='';
$nboffilesinsubdir=$langs->trans("Unknown");
}
print '<li class="directory collapsed">';
print "<a class=\"fmdirlia jqft ecmjqft\" href=\"#\" rel=\"" . dol_escape_htmltag($val['fullrelativename'].'/') . "\" id=\"fmdirlia_id_".$val['id']."\"";
print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")\">";
@ -148,10 +167,10 @@ if( file_exists($fullpathselecteddir) )
// Nb of docs
print '<td align="right">';
print isset($val['cachenbofdoc'])?$val['cachenbofdoc']:'&nbsp;';
print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:'&nbsp;';
print '</td>';
print '<td align="left">';
if ($nbofsubdir && $nboffilesinsubdir) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
print '</td>';
// Edit link
@ -163,16 +182,16 @@ if( file_exists($fullpathselecteddir) )
// Info
print '<td align="right" width="18">';
$userstatic->id=$val['fk_user_c'];
$userstatic->lastname=$val['login_c'];
$userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1).'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.dol_print_date($val['date_c'],"dayhour").'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).'<br>';
$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.$val['cachenbofdoc'].'<br>';
if ($nbofsubdir) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.$nbofsubdir.'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).'<br>';
if ($nboffilesinsubdir > 0) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>';
print $form->textwithpicto('',$htmltooltip,1,"info");
print "</td>";

View File

@ -30,6 +30,8 @@ if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$action=GETPOST('action','alpha');
$name=GETPOST('name','alpha');
/*
* View
@ -45,17 +47,16 @@ top_httphead();
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
// Registering the location of boxes
if ((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) )
if (! empty($action) && ! empty($name))
{
$entity = GETPOST('entity','int');
$action = GETPOST('action', 'alpha');
$name = GETPOST('name', 'alpha');
$value = (GETPOST('value')?GETPOST('value'):1);
if ($user->admin)
{
if ($action == 'set')
{
dolibarr_set_const($db, $name, 1, 'chaine', 0, '', $entity);
dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity);
}
else if ($action == 'del')
{

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -50,11 +50,11 @@ abstract class CommonDocGenerator
'myuser_lastname'=>$user->lastname,
'myuser_firstname'=>$user->firstname,
'myuser_login'=>$user->login,
'myuser_phone'=>$user->officephone,
'myuser_fax'=>$user->officefax,
'myuser_phone'=>$user->office_phone,
'myuser_fax'=>$user->office_fax,
'myuser_mobile'=>$user->user_mobile,
'myuser_email'=>$user->user_email,
'myuser_web'=>$user->url
'myuser_email'=>$user->email,
'myuser_web'=>'' // url not exist in $user object
);
}

View File

@ -382,6 +382,9 @@ class Conf
if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2;
if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8;
// Default max file size for upload
$this->maxfilesize = (! empty($this->global->MAIN_UPLOAD_DOC) ? $this->global->MAIN_UPLOAD_DOC * 1024 : 0);
// Timeouts
if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10;
if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30;

View File

@ -985,8 +985,8 @@ class Form
$out='';
// On recherche les utilisateurs
$sql = "SELECT u.rowid, u.name as lastname, u.firstname, u.login, u.admin, u.entity";
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
$sql = "SELECT DISTINCT u.rowid, u.name as lastname, u.firstname, u.login, u.admin, u.entity";
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$sql.= ", e.label";
}
@ -999,7 +999,16 @@ class Form
}
else
{
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
if (! empty($conf->multicompany->transverse_mode))
{
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ug.fk_user = u.rowid";
$sql.= " AND ug.entity = ".$conf->entity;
}
else
{
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
}
}
if (! empty($user->societe_id)) $sql.= " AND u.fk_societe = ".$user->societe_id;
if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')";

View File

@ -49,7 +49,7 @@ class FormActions
* Show list of action status
*
* @param string $formname Name of form where select in included
* @param string $selected Preselected value
* @param string $selected Preselected value (-1..100)
* @param int $canedit 1=can edit, 0=read only
* @param string $htmlname Name of html prefix for html fields (selectX and valX)
* @return void
@ -96,15 +96,18 @@ class FormActions
$('.hideifna').hide();
}
else if (defaultvalue == 0) {
percentage.attr('disabled', 'disabled');
percentage.val(0);
percentage.attr('disabled', 'disabled');
$('.hideifna').show();
}
else if (defaultvalue == 100) {
percentage.val(100);
percentage.attr('disabled', 'disabled');
$('.hideifna').show();
}
else {
percentage.removeAttr('disabled');
if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50) };
percentage.removeAttr('disabled');
$('.hideifna').show();
}
}

View File

@ -495,17 +495,18 @@ class FormFile
$out.= '</a>'."\n";
if (! $iconPDF)
{
$size=(! empty($file['size'])?$file['size']:dol_filesize($filedir."/".$file["name"]));
$date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"]));
$out.= '</td>';
// Show file size
$out.= '<td align="right" nowrap="nowrap">'.dol_print_size(dol_filesize($filedir."/".$file["name"])).'</td>';
$out.= '<td align="right" nowrap="nowrap">'.dol_print_size($size).'</td>';
// Show file date
$out.= '<td align="right" nowrap="nowrap">'.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').'</td>';
$out.= '<td align="right" nowrap="nowrap">'.dol_print_date($date, 'dayhour').'</td>';
}
if ($delallowed)
{
$out.= '<td align="right">';
//$out.= '<a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath);
$out.= '<a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath);
$out.= ($param?'&'.$param:'');
$out.= '&urlsource='.urlencode($urlsource);
@ -577,7 +578,6 @@ class FormFile
{
if ($file['name'] != '.'
&& $file['name'] != '..'
&& $file['name'] != 'CVS'
&& ! preg_match('/\.meta$/i',$file['name']))
{
// Define relative path used to store the file
@ -704,6 +704,11 @@ class FormFile
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$object_instance=new Contrat($this->db);
}
else if ($modulepart == 'product')
{
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$object_instance=new Product($this->db);
}
else if ($modulepart == 'tax')
{
include_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
@ -733,6 +738,7 @@ class FormFile
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if (! $id && ! $ref) continue;

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -714,7 +714,7 @@ class DoliDBMysql
global $conf;
// Type of encryption (2: AES (recommended), 1: DES , 0: no encryption)
$cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0);
$cryptType = (! empty($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0);
//Encryption key
$cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:'');
@ -747,7 +747,7 @@ class DoliDBMysql
global $conf;
// Type of encryption (2: AES (recommended), 1: DES , 0: no encryption)
$cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0);
$cryptType = (!empty($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0);
//Encryption key
$cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:'');

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -709,7 +709,7 @@ class DoliDBMysqli
global $conf;
// Type of encryption (2: AES (recommended), 1: DES , 0: no encryption)
$cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0);
$cryptType = (!empty($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0);
//Encryption key
$cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:'');
@ -742,7 +742,7 @@ class DoliDBMysqli
global $conf;
// Type of encryption (2: AES (recommended), 1: DES , 0: no encryption)
$cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0);
$cryptType = (!empty($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0);
//Encryption key
$cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:'');

90
htdocs/core/js/blockUI.js Normal file
View File

@ -0,0 +1,90 @@
// Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// or see http://www.gnu.org/
//
//
// \file htdocs/core/js/blockUI.js
// \brief File that include javascript functions for blockUI default options
//
// Examples
$(document).ready(function() {
// override these in your code to change the default behavior and style
$.blockUI.defaults = {
// styles applied when using $.growlUI
dolEventValidCSS: {
width: '350px',
top: '10px',
left: '',
right: '10px',
border: 'none',
padding: '5px',
opacity: 0.8,
cursor: 'default',
color: '#fff',
backgroundColor: '#e3f0db',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
'border-radius': '10px'
},
// styles applied when using $.growlUI
dolEventErrorCSS: {
width: '350px',
top: '10px',
left: '',
right: '10px',
border: 'none',
padding: '5px',
opacity: 0.8,
cursor: 'default',
color: '#a72947',
backgroundColor: '#d79eac',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
'border-radius': '10px'
}
};
$.dolEventValid = function(title, message, timeout, onClose) {
var $m = $('<div class="dolEventValid"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 3000;
$.blockUI({
message: $m, fadeIn: 200, fadeOut: 700, centerY: false,
timeout: timeout, showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.dolEventValidCSS
});
};
$.dolEventError = function(title, message, timeout, onClose) {
var $m = $('<div class="dolEventError"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 0;
$.blockUI({
message: $m, fadeIn: 200, centerY: false,
timeout: timeout, showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.dolEventErrorCSS
});
$('.dolEventError').click($.unblockUI);
};
});

View File

@ -1,5 +1,5 @@
// Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
// Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
// Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
//
// 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
@ -627,8 +627,134 @@ function hideMessage(fieldId,message) {
if (textbox.value == message) textbox.value = '';
}
/*
*
*/
function setConstant(url, code, input, entity) {
$.get( url, {
action: "set",
name: code,
entity: entity
},
function() {
$("#set_" + code).hide();
$("#del_" + code).show();
$.each(input, function(type, data) {
// Enable another element
if (type == "disabled") {
$.each(data, function(key, value) {
$("#" + value).removeAttr("disabled");
if ($("#" + value).hasClass("butActionRefused") == true) {
$("#" + value).removeClass("butActionRefused");
$("#" + value).addClass("butAction");
}
});
// Show another element
} else if (type == "showhide" || type == "show") {
$.each(data, function(key, value) {
$("#" + value).show();
});
// Set another constant
} else if (type == "set") {
$.each(data, function(key, value) {
$("#set_" + key).hide();
$("#del_" + key).show();
$.get( url, {
action: "set",
name: key,
value: value,
entity: entity
});
});
}
});
});
}
/*
*
*/
function delConstant(url, code, input, entity) {
$.get( url, {
action: "del",
name: code,
entity: entity
},
function() {
$("#del_" + code).hide();
$("#set_" + code).show();
$.each(input, function(type, data) {
// Disable another element
if (type == "disabled") {
$.each(data, function(key, value) {
$("#" + value).attr("disabled", true);
if ($("#" + value).hasClass("butAction") == true) {
$("#" + value).removeClass("butAction");
$("#" + value).addClass("butActionRefused");
}
});
// Hide another element
} else if (type == "showhide" || type == "hide") {
$.each(data, function(key, value) {
$("#" + value).hide();
});
// Delete another constant
} else if (type == "del") {
$.each(data, function(key, value) {
$("#del_" + value).hide();
$("#set_" + value).show();
$.get( url, {
action: "del",
name: value,
entity: entity
});
});
}
});
});
}
/*
*
*/
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) {
$("#confirm_" + code)
.attr("title", box.title)
.html(box.content)
.dialog({
resizable: false,
height: 170,
width: 500,
modal: true,
buttons: [
{
text : yesButton,
click : function() {
if (action == "set") {
setConstant(url, code, input, entity);
} else if (action == "del") {
delConstant(url, code, input, entity);
}
// Close dialog
$(this).dialog("close");
// Execute another function
if (box.function) {
var fnName = box.function;
if (window.hasOwnProperty(fnName)) {
window[fnName]();
}
}
}
},
{
text : noButton,
click : function() {
$(this).dialog("close");
}
}
]
});
}
/* This is to allow to transform all select box into ajax autocomplete box
* with just one line: $(function() { $( "#listmotifcons" ).combobox(); });

View File

@ -277,7 +277,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
modal: true,
buttons: {
Ok: function() {
jQuery(this ).dialog(\'close\');
jQuery(this).dialog(\'close\');
}
}
});
@ -346,11 +346,11 @@ function ajax_combobox($htmlname, $event=array())
* On/off button for constant
*
* @param string $code Name of constant
* @param array $input Input element
* @param array $input Input element (enable/disable or show/hide another element, set/del another constant)
* @param int $entity Entity to set
* @return void
*/
function ajax_constantonoff($code,$input=array(),$entity=false)
function ajax_constantonoff($code, $input=array(), $entity=false)
{
global $conf, $langs;
@ -359,65 +359,33 @@ function ajax_constantonoff($code,$input=array(),$entity=false)
$out= '<script type="text/javascript">
$(function() {
var input = '.json_encode($input).';
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
var code = \''.$code.'\';
var entity = \''.$entity.'\';
var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'";
var noButton = "'.dol_escape_js($langs->transnoentities("No")).'";
// Set constant
$("#set_'.$code.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/constantonoff.php", {
action: \'set\',
name: \''.$code.'\',
entity: \''.$entity.'\'
},
function() {
$("#set_'.$code.'").hide();
$("#del_'.$code.'").show();
// Enable another element
if (input.disabled && input.disabled.length > 0) {
$.each(input.disabled, function(key,value) {
$("#" + value).removeAttr("disabled");
if ($("#" + value).hasClass("butActionRefused") == true) {
$("#" + value).removeClass("butActionRefused");
$("#" + value).addClass("butAction");
}
});
// Show another element
} else if (input.showhide && input.showhide.length > 0) {
$.each(input.showhide, function(key,value) {
$("#" + value).show();
});
}
});
$("#set_" + code).click(function() {
if (input.alert && input.alert.set) {
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton);
} else {
setConstant(url, code, input, entity);
}
});
// Del constant
$("#del_'.$code.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/constantonoff.php", {
action: \'del\',
name: \''.$code.'\',
entity: \''.$entity.'\'
},
function() {
$("#del_'.$code.'").hide();
$("#set_'.$code.'").show();
// Disable another element
if (input.disabled && input.disabled.length > 0) {
$.each(input.disabled, function(key,value) {
$("#" + value).attr("disabled", true);
if ($("#" + value).hasClass("butAction") == true) {
$("#" + value).removeClass("butAction");
$("#" + value).addClass("butActionRefused");
}
});
// Hide another element
} else if (input.showhide && input.showhide.length > 0) {
$.each(input.showhide, function(key,value) {
$("#" + value).hide();
});
}
});
$("#del_" + code).click(function() {
if (input.alert && input.alert.del) {
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton);
} else {
delConstant(url, code, input, entity);
}
});
});
</script>';
$out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
$out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.img_picto($langs->trans("Disabled"),'switch_off').'</span>';
$out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.img_picto($langs->trans("Enabled"),'switch_on').'</span>';

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
*
* 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
@ -43,10 +43,10 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
global $db, $conf, $langs;
$idprod=$line->fk_product;
$label=$line->label; if (empty($label)) $label=$line->libelle;
$desc=$line->desc; if (empty($desc)) $desc=$line->description;
$ref_supplier=$line->ref_supplier; if (empty($ref_supplier)) $ref_supplier=$line->ref_fourn; // TODO Not yet saved for supplier invoices, only supplier orders
$note=$line->note;
$label=(! empty($line->label)?$line->label:(! empty($line->libelle)?$line->libelle:''));
$desc=(! empty($line->desc)?$line->desc:(! empty($line->description)?$line->description:''));
$ref_supplier=(! empty($line->ref_supplier)?$line->ref_supplier:(! empty($line->ref_fourn)?$line->ref_fourn:'')); // TODO Not yet saved for supplier invoices, only supplier orders
$note=(! empty($line->note)?$line->note:'');
if ($issupplierline) $prodser = new ProductFournisseur($db);
else $prodser = new Product($db);
@ -55,7 +55,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
{
$prodser->fetch($idprod);
// If a predefined product and multilang and on other lang, we renamed label with label translated
if ($conf->global->MAIN_MULTILANGS && ($outputlangs->defaultlang != $langs->defaultlang))
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"];
@ -89,7 +89,8 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
{
if ($idprod)
{
if ( empty($hidedesc) ) $libelleproduitservice.=$desc;
if (empty($hidedesc))
$libelleproduitservice.=$desc;
}
else
{
@ -106,9 +107,9 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
{
$prefix_prodserv = "";
$ref_prodserv = "";
if ($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS) // In standard mode, we do not show this
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
{
if($prodser->isservice())
if ($prodser->isservice())
{
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
}
@ -118,7 +119,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
}
}
if ( empty($hideref) )
if (empty($hideref))
{
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
else $ref_prodserv = $prodser->ref; // Show local ref only
@ -130,7 +131,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
}
}
if ($line->date_start || $line->date_end)
if (! empty($line->date_start) || ! empty($line->date_end))
{
$format='day';
// Show duration if exists

View File

@ -139,12 +139,12 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
closedir($dir);
// Obtain a list of columns
if ($sortcriteria)
if (! empty($sortcriteria))
{
$myarray=array();
foreach ($file_list as $key => $row)
{
$myarray[$key] = $row[$sortcriteria];
$myarray[$key] = (isset($row[$sortcriteria])?$row[$sortcriteria]:'');
}
// Sort the data
if ($sortorder) array_multisort($myarray, $sortorder, $file_list);

View File

@ -3033,10 +3033,11 @@ function get_exdir($num,$level=3,$alpha=0,$withoutslash=0)
/**
* Creation of a directory (this can create recursive subdir)
*
* @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir')
* @return int < 0 if KO, 0 = already exists, > 0 if OK
* @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir')
* @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used)
* @return int < 0 if KO, 0 = already exists, > 0 if OK
*/
function dol_mkdir($dir)
function dol_mkdir($dir, $dataroot='')
{
global $conf;
@ -3048,13 +3049,19 @@ function dol_mkdir($dir)
$nberr=0;
$nbcreated=0;
$ccdir = '';
$cdir = explode("/",$dir);
$ccdir='';
if (! empty($dataroot)) {
// Remove data root from loop
$dir = str_replace($dataroot.'/', '', $dir);
$ccdir = $dataroot.'/';
}
$cdir = explode("/", $dir);
$num=count($cdir);
for ($i = 0; $i < $num; $i++)
{
if ($i > 0) $ccdir .= '/'.$cdir[$i];
else $ccdir = $cdir[$i];
else $ccdir .= $cdir[$i];
if (preg_match("/^.:$/",$ccdir,$regs)) continue; // Si chemin Windows incomplet, on poursuit par rep suivant
// Attention, le is_dir() peut echouer bien que le rep existe.
@ -3582,14 +3589,19 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
if ($out)
{
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded))
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded))
{
$return = '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery.jnotify("'.dol_escape_js($out).'",
"'.($style=="ok" ? 3000 : $style).'",
'.($style=="ok" ? "false" : "true").',
{ remove: function (){} } );
$(document).ready(function() {
var block = '.(! empty($conf->global->MAIN_USE_JQUERY_BLOCKUI)?"true":"false").'
if (block) {
$.dolEventValid("","'.dol_escape_js($out).'");
} else {
$.jnotify("'.dol_escape_js($out).'",
"'.($style=="ok" ? 3000 : $style).'",
'.($style=="ok" ? "false" : "true").',
{ remove: function (){} } );
}
});
</script>';
}

View File

@ -271,7 +271,8 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
{
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->supprimer.' write='.$user->rights->$feature->delete;
if (empty($user->rights->$feature->supprimer)
&& empty($user->rights->$feature->delete)) $deleteok=0;
&& empty($user->rights->$feature->delete)
&& empty($user->rights->$feature->run)) $deleteok=0;
}
}
@ -488,4 +489,4 @@ function accessforbidden($message='',$printheader=1,$printfooter=1,$showonlymess
exit(0);
}
?>
?>

View File

@ -101,8 +101,7 @@ function tree_showpad(&$fulltree,$key,$silent=0)
if ($fulltree[$key2]['level'] > $pos)
{
$nbofdirinsub++;
if (! empty($fulltree[$key2]['cachenbofdoc']))
$nbofdocinsub+=$fulltree[$key2]['cachenbofdoc'];
if (isset($fulltree[$key2]['cachenbofdoc']) && $fulltree[$key2]['cachenbofdoc'] > 0) $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc'];
}
if ($fulltree[$key2]['level'] == $pos)
{

View File

@ -1170,7 +1170,7 @@ abstract class DolibarrModules
$err=0;
if (is_array($this->dirs))
if (isset($this->dirs) && is_array($this->dirs))
{
foreach ($this->dirs as $key => $value)
{
@ -1184,19 +1184,19 @@ abstract class DolibarrModules
$subname = empty($this->dirs[$key][3])?'':strtoupper($this->dirs[$key][3]); // Add submodule name (ex: $conf->module->submodule->dir_output)
$forcename = empty($this->dirs[$key][4])?'':strtoupper($this->dirs[$key][4]); // Change the module name if different
if ($forcename) $constname = 'MAIN_MODULE_'.$forcename."_DIR_";
if ($subname) $constname = $constname.$subname."_";
if (! empty($forcename)) $constname = 'MAIN_MODULE_'.$forcename."_DIR_";
if (! empty($subname)) $constname = $constname.$subname."_";
$name = $constname.strtoupper($this->dirs[$key][0]);
$name = $constname.strtoupper($this->dirs[$key][0]);
}
// Define directory full path ($dir must start with "/")
if (empty($conf->global->MAIN_MODULE_MULTICOMPANY) || $conf->entity == 1) $fulldir = DOL_DATA_ROOT.$dir;
else $fulldir = DOL_DATA_ROOT."/".$conf->entity.$dir;
// Create dir if it does not exists
if ($fulldir && ! file_exists($fulldir))
if (! empty($fulldir) && ! file_exists($fulldir))
{
if (dol_mkdir($fulldir) < 0)
if (dol_mkdir($fulldir, DOL_DATA_ROOT) < 0)
{
$this->error = $langs->trans("ErrorCanNotCreateDir",$fulldir);
dol_syslog(get_class($this)."::_init ".$this->error, LOG_ERR);
@ -1205,9 +1205,9 @@ abstract class DolibarrModules
}
// Define the constant in database if requested (not the default mode)
if ($addtodatabase)
if (! empty($addtodatabase))
{
$result = $this->insert_dirs($name,$dir);
$result = $this->insert_dirs($name, $dir);
if ($result) $err++;
}
}
@ -1273,7 +1273,7 @@ abstract class DolibarrModules
$err=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$this->db->decrypt('name')." like '".$this->const_name."_DIR_%'";
$sql.= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->const_name."_DIR_%'";
$sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::delete_dirs sql=".$sql);
@ -1408,4 +1408,4 @@ abstract class DolibarrModules
}
}
?>
?>

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <ely@users.sourceforge.net>
/* Copyright (C) 2010-2012 Laurent Destailleur <ely@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* 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
@ -108,12 +109,12 @@ class doc_generic_invoice_odt extends ModelePDFFactures
'object_ref'=>$object->ref,
'object_ref_ext'=>$object->ref_ext,
'object_ref_customer'=>$object->ref_client,
'object_ref_supplier'=>$object->ref_fournisseur,
'object_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''),
'object_source_invoice_ref'=>$invoice_source->ref,
'object_date'=>dol_print_date($object->date,'day'),
'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'),
'object_date_creation'=>dol_print_date($object->date_creation,'day'),
'object_date_modification'=>dol_print_date($object->date_modification,'day'),
'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''),
'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'),
'object_payment_mode_code'=>$object->mode_reglement_code,
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
@ -122,7 +123,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
'object_vatrate'=>vatrate($object->tva),
'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''),
'object_note_private'=>$object->note,
'object_note'=>$object->note_public,
// Payments
@ -339,7 +340,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
'__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat
'__TOTAL_VAT__' => $object->total_tva
);
complete_substitutions_array($substitutionarray, $langs, $object);

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -95,21 +95,23 @@ class ImportCsv extends ModeleImports
}
/**
* getDriverLabel
* getDriverLabel
*
* @return string Label
* @param string $key Key
* @return string Label
*/
function getDriverLabel()
function getDriverLabel($key='')
{
return $this->label;
}
/**
* getDriverDesc
* getDriverDesc
*
* @return string Description
* @param string $key Key
* @return string Description
*/
function getDriverDesc()
function getDriverDesc($key='')
{
return $this->desc;
}
@ -125,21 +127,23 @@ class ImportCsv extends ModeleImports
}
/**
* getDriverVersion
* getDriverVersion
*
* @return string Driver version
* @param string $key Key
* @return string Driver version
*/
function getDriverVersion()
function getDriverVersion($key='')
{
return $this->version;
}
/**
* getDriverLabel
* getDriverLabel
*
* @return string Label of external lib
* @param string $key Key
* @return string Label of external lib
*/
function getLibLabel()
function getLibLabel($key='')
{
return $this->label_lib;
}
@ -147,9 +151,10 @@ class ImportCsv extends ModeleImports
/**
* getLibVersion
*
* @return string Version of external lib
* @param string $key Key
* @return string Version of external lib
*/
function getLibVersion()
function getLibVersion($key='')
{
return $this->version_lib;
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -94,12 +94,12 @@ class ModeleImports
// Picto
$this->picto[$module->id]=$module->picto;
// Driver properties
$this->_driverlabel[$module->id]=$module->getDriverLabel();
$this->_driverdesc[$module->id]=$module->getDriverDesc();
$this->_driverversion[$module->id]=$module->getDriverVersion();
$this->_driverlabel[$module->id]=$module->getDriverLabel('');
$this->_driverdesc[$module->id]=$module->getDriverDesc('');
$this->_driverversion[$module->id]=$module->getDriverVersion('');
// If use an external lib
$this->_liblabel[$module->id]=$module->getLibLabel();
$this->_libversion[$module->id]=$module->getLibVersion();
$this->_liblabel[$module->id]=$module->getLibLabel('');
$this->_libversion[$module->id]=$module->getLibVersion('');
$i++;
}

View File

@ -34,6 +34,23 @@ print '<head>
print '<!-- Includes for JQuery (Ajax library) -->'."\n";
if (constant('JS_JQUERY_UI')) print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
else print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui-latest.custom.css" />'."\n"; // JQuery
// CSS forced by modules (relative url starting with /)
if (isset($conf->modules_parts['css']))
{
$arraycss=(array) $conf->modules_parts['css'];
foreach($arraycss as $modcss => $filescss)
{
$filescss=(array) $filescss; // To be sure filecss is an array
foreach($filescss as $cssfile)
{
// cssfile is a relative path
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '"><!-- Added by module '.$modcss. '-->'."\n";
}
}
}
// JQuery. Must be before other includes
$ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
@ -98,10 +115,12 @@ $(document).ready(function () {
<?php
if (! empty($hookmanager->resArray['options'])) {
foreach ($hookmanager->resArray['options'] as $option)
foreach ($hookmanager->resArray['options'] as $format => $option)
{
echo '<!-- Option by hook -->';
echo $option;
if ($format == 'table') {
echo '<!-- Option by hook -->';
echo $option;
}
}
}
?>

View File

@ -26,14 +26,14 @@
*/
?>
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
<!-- BEGIN PHP TEMPLATE objectline_add.tpl.php -->
<tr class="liste_titre nodrag nodrop">
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><div id="add"></div><?php echo $langs->trans('AddNewLine'); ?></td>
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
<td align="right"><?php echo $langs->trans('PriceUHT'); ?></td>
<td align="right"><?php echo $langs->trans('PriceUTTC'); ?></td>
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
<td align="right" width="50"><?php echo $langs->trans('VAT'); ?></td>
<td align="right" width="80"><?php echo $langs->trans('PriceUHT'); ?></td>
<td align="right" width="80"><?php echo $langs->trans('PriceUTTC'); ?></td>
<td align="right" width="50"><?php echo $langs->trans('Qty'); ?></td>
<td align="right" width="50"><?php echo $langs->trans('ReductionShort'); ?></td>
<?php
$colspan = 4;
$colspan2 = 12;
@ -522,4 +522,4 @@ $("#idprod").change(function() {
});
</script>
<?php } ?>
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
<!-- END PHP TEMPLATE objectline_add.tpl.php -->

View File

@ -34,11 +34,30 @@ print '<head>
print '<!-- Includes for JQuery (Ajax library) -->'."\n";
if (constant('JS_JQUERY_UI')) print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
else print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui-latest.custom.css" />'."\n"; // JQuery
// CSS forced by modules (relative url starting with /)
if (isset($conf->modules_parts['css']))
{
$arraycss=(array) $conf->modules_parts['css'];
foreach($arraycss as $modcss => $filescss)
{
$filescss=(array) $filescss; // To be sure filecss is an array
foreach($filescss as $cssfile)
{
// cssfile is a relative path
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '"><!-- Added by module '.$modcss. '-->'."\n";
}
}
}
// JQuery. Must be before other includes
$ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
print '<!-- Includes JS for JQuery -->'."\n";
if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
print '<link rel="stylesheet" type="text/css" href="'.$conf_css.'" />'."\n";
print '<link rel="stylesheet" type="text/css" href="'.dol_escape_htmltag($conf_css).'" />'."\n";
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER;
print '<!-- HTTP_USER_AGENT = '.$_SERVER['HTTP_USER_AGENT'].' -->
</head>';
@ -68,12 +87,17 @@ print '<!-- HTTP_USER_AGENT = '.$_SERVER['HTTP_USER_AGENT'].' -->
<input type="text" <?php echo $disabled; ?> id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></td>
</tr>
<?php if ($select_entity) { ?>
<tr><td valign="top" nowrap="nowrap"> &nbsp; <b><?php echo $langs->trans('Entity'); ?></b> &nbsp; </td>
<td valign="top" nowrap="nowrap">
<?php echo $select_entity; ?>
</td></tr>
<?php } ?>
<?php
if (! empty($hookmanager->resArray['options'])) {
foreach ($hookmanager->resArray['options'] as $format => $option)
{
if ($format == 'table') {
echo '<!-- Option by hook -->';
echo $option;
}
}
}
?>
<?php if ($captcha) { ?>
<tr><td valign="middle" nowrap="nowrap"> &nbsp; <b><?php echo $langs->trans('SecurityCode'); ?></b></td>

View File

@ -75,46 +75,17 @@ if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
$type = 'application/octet-stream';
if (GETPOST('type','alpha')) $type=GETPOST('type','alpha');
else $type=dol_mimetype($original_file);
//print 'X'.$type.'-'.$original_file;exit;
// Define attachment (attachment=true to force choice popup 'open'/'save as')
$attachment = true;
// Text files
if (preg_match('/\.txt$/i',$original_file)) { $attachment = false; }
if (preg_match('/\.csv$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.tsv$/i',$original_file)) { $attachment = true; }
// Documents MS office
if (preg_match('/\.doc(x)?$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.dot(x)?$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.mdb$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.ppt(x)?$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.xls(x)?$/i',$original_file)) { $attachment = true; }
// Documents Open office
if (preg_match('/\.odp$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.ods$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.odt$/i',$original_file)) { $attachment = true; }
// Misc
if (preg_match('/\.(html|htm)$/i',$original_file)) { $attachment = false; }
if (preg_match('/\.pdf$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.sql$/i',$original_file)) { $attachment = true; }
// Images
if (preg_match('/\.jpg$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.jpeg$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.png$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.gif$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.bmp$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.tiff$/i',$original_file)) { $attachment = true; }
// Calendar
if (preg_match('/\.vcs$/i',$original_file)) { $attachment = true; }
if (preg_match('/\.ics$/i',$original_file)) { $attachment = true; }
if (GETPOST("attachment")) { $attachment = true; }
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
//print "XX".$attachment;exit;
// Define attachment (attachment=true to force choice popup 'open'/'save as')
$attachment = true;
if (preg_match('/\.(html|htm)$/i',$original_file)) $attachment = false;
if (isset($_GET["attachment"])) $attachment = GETPOST("attachment")?true:false;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
// Suppression de la chaine de caractere ../ dans $original_file
$original_file = str_replace("../","/", $original_file);
// find the subdirectory name as the reference
// Suppression de la chaine de caractere ../ dans $original_file
$original_file = str_replace("../","/", $original_file);
// Find the subdirectory name as the reference
$refname=basename(dirname($original_file)."/");
// Security check
@ -382,6 +353,14 @@ if ($modulepart)
$original_file=$conf->admin->dir_output.'/'.$original_file;
}
// Wrapping for upload file test
else if ($modulepart == 'admin_temp')
{
if ($user->admin)
$accessallowed=1;
$original_file=$conf->admin->dir_temp.'/'.$original_file;
}
// Wrapping pour BitTorrent
else if ($modulepart == 'bittorrent')
{
@ -483,65 +462,38 @@ if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
exit;
}
// TODO Remove this. Some part of code still use it.
if ($action == 'remove_file') // Remove a file
clearstatcache();
$filename = basename($original_file);
// Output file on browser
dol_syslog("document.php download $original_file $filename content-type=$type");
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
// This test if file exists should be useless. We keep it to find bug more easily
if (! file_exists($original_file_osencoded))
{
clearstatcache();
dol_syslog("document.php remove $original_file $urlsource", LOG_DEBUG);
// This test should be useless. We keep it to find bug more easily
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
if (! file_exists($original_file_osencoded))
{
$file=basename($original_file); // Do no show plain path of original_file in shown error message
dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$file));
exit;
}
$ret=dol_delete_file($original_file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
dol_syslog("document.php back to ".urldecode($urlsource), LOG_DEBUG);
header("Location: ".urldecode($urlsource));
return;
dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
exit;
}
else // Open and return file
{
clearstatcache();
$filename = basename($original_file);
// Les drois sont ok et fichier trouve, on l'envoie
// Output file on browser
dol_syslog("document.php download $original_file $filename content-type=$type");
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
header('Content-Description: File Transfer');
if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type.(preg_match('/text/',$type)?'; charset="'.$conf->file->character_set_client:''));
// Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, atachment=need user action to open)
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
header('Content-Length: ' . dol_filesize($original_file));
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
// This test if file exists should be useless. We keep it to find bug more easily
if (! file_exists($original_file_osencoded))
{
dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
exit;
}
//ob_clean();
//flush();
// Les drois sont ok et fichier trouve, on l'envoie
header('Content-Description: File Transfer');
if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type.(preg_match('/text/',$type)?'; charset="'.$conf->file->character_set_client:''));
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
header('Content-Length: ' . dol_filesize($original_file));
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
//ob_clean();
//flush();
readfile($original_file_osencoded);
}
readfile($original_file_osencoded);
?>

View File

@ -20,13 +20,11 @@
* \file htdocs/ecm/class/ecmdirectory.class.php
* \ingroup ecm
* \brief This file is an example for a class file
* \author Laurent Destailleur
*/
/**
* \class EcmDirectory
* \brief Class to manage ECM directories
* \remarks Initialy built by build_class_from_table on 2008-02-24 19:24
*/
class EcmDirectory // extends CommonObject
{
@ -38,7 +36,7 @@ class EcmDirectory // extends CommonObject
var $label;
var $fk_parent;
var $description;
var $cachenbofdoc;
var $cachenbofdoc=-1; // By default cache initialized with value 'not calculated'
var $date_c;
var $date_m;
@ -77,7 +75,6 @@ class EcmDirectory // extends CommonObject
$this->label=dol_sanitizeFileName(trim($this->label));
$this->fk_parent=trim($this->fk_parent);
$this->description=trim($this->description);
if (! $this->cachenbofdoc) $this->cachenbofdoc=0;
$this->date_c=$now;
$this->fk_user_c=$user->id;
if ($this->fk_parent <= 0) $this->fk_parent=0;
@ -132,7 +129,7 @@ class EcmDirectory // extends CommonObject
$sql.= " '".$conf->entity."',";
$sql.= " '".$this->fk_parent."',";
$sql.= " '".$this->db->escape($this->description)."',";
$sql.= " ".($this->cachenbofdoc).",";
$sql.= " ".$this->cachenbofdoc.",";
$sql.= " '".$this->db->idate($this->date_c)."',";
$sql.= " '".$this->fk_user_c."'";
$sql.= ")";
@ -544,8 +541,7 @@ class EcmDirectory // extends CommonObject
$sql.= " c.date_c,";
$sql.= " u.login as login_c,";
$sql.= " ca.rowid as rowid_fille";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= ", ".MAIN_DB_PREFIX."ecm_directories as c";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."ecm_directories as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."ecm_directories as ca";
$sql.= " ON c.rowid = ca.fk_parent";
$sql.= " WHERE c.fk_user_c = u.rowid";
@ -569,9 +565,9 @@ class EcmDirectory // extends CommonObject
$this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c;
$this->cats[$obj->rowid]['login_c'] = $obj->login_c;
if ($obj->rowid_fille)
if (! empty($obj->rowid_fille))
{
if (is_array($this->cats[$obj->rowid]['id_children']))
if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children']))
{
$newelempos=count($this->cats[$obj->rowid]['id_children']);
//print "this->cats[$i]['id_children'] est deja un tableau de $newelem elements<br>";
@ -650,10 +646,10 @@ class EcmDirectory // extends CommonObject
}
/**
* Refresh value for cachenboffile
* Refresh value for cachenboffile. This scan and count files into directory.
*
* @param int $all 0=refresh this id , 1=refresh this entity
* @return int <0 if KO, Nb of files in directory if OK
* @param int $all 0=refresh record using this->id , 1=refresh record using this->entity
* @return int -1 if KO, Nb of files in directory if OK
*/
function refreshcachenboffile($all=0)
{

View File

@ -124,7 +124,7 @@ if ($action == 'add' && $user->rights->ecm->setup)
}
// Suppression fichier
if ($action == 'confirm_deletesection' && $confirm == 'yes')
else if ($action == 'confirm_deletesection' && $confirm == 'yes')
{
$result=$ecmdir->delete($user);
setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label));

View File

@ -205,7 +205,7 @@ if ($action == 'refreshmanual')
$diroutputslash.='/';
// Scan directory tree on disk
$disktree=dol_dir_list($conf->ecm->dir_output,'directories',1,'','','','',0);
$disktree=dol_dir_list($conf->ecm->dir_output,'directories',1,'','^temp$','','',0);
// Scan directory tree in database
$sqltree=$ecmdirstatic->get_full_arbo(0);
@ -283,7 +283,7 @@ if ($action == 'refreshmanual')
$txt="We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
dol_syslog($txt);
//print $txt."<br>\n";
//print $ecmdirtmp->cachenbofdoc."<br>\n";exit;
$id = $ecmdirtmp->create($user);
if ($id > 0)
{
@ -309,7 +309,8 @@ if ($action == 'refreshmanual')
}
}
$sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc=0 WHERE cachenbofdoc < 0";
$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);
// If a directory was added, the fulltree array is not correctly completed and sorted, so we clean
@ -378,7 +379,7 @@ llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,
// Add sections to manage
$rowspan=0;
$sectionauto=array();
if ($conf->product->enabled || $conf->service->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>$conf->product->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
if ($conf->product->enabled || $conf->service->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>($conf->product->enabled || $conf->service->enabled), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); }
if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
@ -693,7 +694,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
$result=$ecmdirstatic->fetch($val['id']);
$ecmdirstatic->ref=$ecmdirstatic->label;
$result=$ecmdirstatic->refreshcachenboffile();
$result=$ecmdirstatic->refreshcachenboffile(0);
$val['cachenbofdoc']=$result;
}

View File

@ -48,9 +48,9 @@ $result = restrictedArea($user, 'ecm','');
$user->getrights('ecm');
// Get parameters
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
$action = isset($_GET["action"])?$_GET["action"]:$_POST['action'];
$section=isset($_GET["section"])?$_GET["section"]:$_POST['section'];
$socid = GETPOST('socid','int');
$action = GETPOST('action','alpha');
$section=GETPOST('section');
if (! $section) $section=0;
$upload_dir = $conf->ecm->dir_output.'/'.$section;
@ -66,9 +66,9 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="label";
$ecmdir = new EcmDirectory($db);
if (! empty($_REQUEST["section"]))
if (! empty($section))
{
$result=$ecmdir->fetch($_REQUEST["section"]);
$result=$ecmdir->fetch($section);
if (! $result > 0)
{
dol_print_error($db,$ecmdir->error);
@ -123,10 +123,8 @@ print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("Search"));
//print "<br>\n";
print $langs->trans("FeatureNotYetAvailable").'.<br><br>';
if ($mesg) { print $mesg."<br>"; }
// Tool bar
$head = ecm_prepare_head_fm($fac);
$head = ecm_prepare_head_fm($ecmdir);
//dol_fiche_head($head, 'search_form', '', 1);
@ -210,7 +208,6 @@ print '</table>';
print '<br>';
// End of page
$db->close();
llxFooter();
$db->close();
?>

View File

@ -96,7 +96,7 @@ class Import
require_once $file;
$module = new $classname($this->db);
if (is_array($module->import_code))
if (isset($module->import_code) && is_array($module->import_code))
{
foreach($module->import_code as $r => $value)
{
@ -138,7 +138,7 @@ class Import
// Array of tables to import (key=alias, value=tablename)
$this->array_import_tables[$i]=$module->import_tables_array[$r];
// Array of tables creator field to import (key=alias, value=creator field)
$this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r];
$this->array_import_tables_creator[$i]=(isset($module->import_tables_creator_array[$r])?$module->import_tables_creator_array[$r]:'');
// Array of fields to import (key=field, value=label)
$this->array_import_fields[$i]=$module->import_fields_array[$r];
// Array of hidden fields to import (key=field, value=label)
@ -150,7 +150,7 @@ class Import
// Tableau des alias a exporter (cle=champ, valeur=exemple)
$this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r];
// Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles)
$this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r];
$this->array_import_convertvalue[$i]=(isset($module->import_convertvalue_array[$r])?$module->import_convertvalue_array[$r]:'');
// Module
$this->array_import_module[$i]=$module;

View File

@ -35,8 +35,8 @@ $langs->load("exports");
$langs->load("errors");
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'import',$origin_id,'');
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result=restrictedArea($user, 'import');
$entitytoicon=array(
'invoice'=>'bill','invoice_line'=>'bill',
@ -68,7 +68,8 @@ $entitytolang=array( // Translation code
$datatoimport = GETPOST('datatoimport');
$format = GETPOST('format');
$filetoimport = GETPOST('filetoimport');
$action = GETPOST('action');
$action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha');
$step = (GETPOST('step') ? GETPOST('step') : 1);
$import_name = GETPOST('import_name');
$hexa = GETPOST('hexa');
@ -92,7 +93,7 @@ foreach($fieldsarray as $elem)
{
$tabelem=explode('=',$elem,2);
$key=$tabelem[0];
$val=$tabelem[1];
$val=(isset($tabelem[1])?$tabelem[1]:'');
if ($key && $val)
{
$array_match_file_to_database[$key]=$val;
@ -192,7 +193,7 @@ if ($action == 'add_import_model')
if ($step == 3 && $datatoimport)
{
if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
dol_mkdir($conf->import->dir_temp);
$nowyearmonth=dol_print_date(dol_now(),'%Y%m%d%H%M%S');
@ -205,9 +206,25 @@ if ($step == 3 && $datatoimport)
else
{
$langs->load("errors");
$mesg = $langs->trans("ErrorFailedToSaveFile");
setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors');
}
}
// Delete file
if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
$langs->load("other");
$param='&datatoimport='.$datatoimport.'&format='.$format;
if ($excludefirstline) $param.='&excludefirstline=1';
$file = $conf->import->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?step='.$step.$param);
exit;
}
}
if ($step == 4 && $action == 'select_model')
@ -305,7 +322,7 @@ if ($step == 1 || ! $datatoimport)
$array_match_file_to_database=array();
$_SESSION["dol_array_match_file_to_database"]='';
$parm='';
$param='';
if ($excludefirstline) $param.='&excludefirstline=1';
llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:M&oacute;dulo_Importaciones');
@ -447,10 +464,18 @@ if ($step == 3 && $datatoimport)
llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:M&oacute;dulo_Importaciones');
$head = import_prepare_head($param,3);
$head = import_prepare_head($param, 3);
dol_fiche_head($head, 'step3', $langs->trans("NewImport"));
/*
* Confirm delete file
*/
if ($action == 'delete')
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?urlfile='.urlencode(GETPOST('urlfile')).'&step=3'.$param, $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>';
}
print '<table width="100%" class="border">';
@ -511,7 +536,7 @@ if ($step == 3 && $datatoimport)
print "</tr>\n";
// Search available imports
$filearray=dol_dir_list($conf->import->dir_temp,'files',0,'','','name',SORT_DESC);
$filearray=dol_dir_list($conf->import->dir_temp, 'files', 0, '', '', 'name', SORT_DESC);
if (count($filearray) > 0)
{
$dir=$conf->import->dir_temp;
@ -534,8 +559,6 @@ if ($step == 3 && $datatoimport)
print '<tr '.$bc[$var].'>';
print '<td width="16">'.img_mime($file).'</td>';
print '<td>';
$modulepart='import';
//$relativepath=$filetoimport;
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=3'.$param.'" target="_blank">';
print $file;
print '</a>';
@ -545,12 +568,11 @@ if ($step == 3 && $datatoimport)
// Affiche date fichier
print '<td align="right">'.dol_print_date(dol_filemtime($dir.'/'.$file),'dayhour').'</td>';
// Del button
print '<td align="right"><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&step=3'.$param.'&modulepart='.$modulepart.'&file='.urlencode($relativepath);
print '&urlsource='.urlencode($urlsource);
print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=delete&step=3'.$param.'&urlfile='.urlencode($relativepath);
print '">'.img_delete().'</a></td>';
// Action button
print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/imports/import.php?step=4'.$param.'&filetoimport='.urlencode($relativepath).'">'.img_picto($langs->trans("NewImport"),'filenew').'</a>';
print '<a href="'.$_SERVER['PHP_SELF'].'?step=4'.$param.'&filetoimport='.urlencode($relativepath).'">'.img_picto($langs->trans("NewImport"),'filenew').'</a>';
print '</td>';
print '</tr>';
}

View File

@ -0,0 +1,529 @@
/*!
* jQuery blockUI plugin
* Version 2.43 (29-JUL-2012)
* @requires jQuery v1.2.3 or later
*
* Examples at: http://malsup.com/jquery/block/
* Copyright (c) 2007-2010 M. Alsup
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/
;(function() {
function setup($) {
if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
return;
}
$.fn._fadeIn = $.fn.fadeIn;
var noOp = function() {};
// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
// retarded userAgent strings on Vista)
var mode = document.documentMode || 0;
var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
// global $ methods for blocking/unblocking the entire page
$.blockUI = function(opts) { install(window, opts); };
$.unblockUI = function(opts) { remove(window, opts); };
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
$.growlUI = function(title, message, timeout, onClose) {
var $m = $('<div class="growlUI"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 3000;
$.blockUI({
message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
timeout: timeout, showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.growlCSS
});
};
// plugin method for blocking element content
$.fn.block = function(opts) {
var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
this.each(function() {
var $el = $(this);
if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
return;
$el.unblock({ fadeOut: 0 });
});
return this.each(function() {
if ($.css(this,'position') == 'static')
this.style.position = 'relative';
if ($.browser.msie)
this.style.zoom = 1; // force 'hasLayout'
install(this, opts);
});
};
// plugin method for unblocking element content
$.fn.unblock = function(opts) {
return this.each(function() {
remove(this, opts);
});
};
$.blockUI.version = 2.42; // 2nd generation blocking at no extra cost!
// override these in your code to change the default behavior and style
$.blockUI.defaults = {
// message displayed when blocking (use null for no message)
message: '<h1>Please wait...</h1>',
title: null, // title string; only used when theme == true
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
theme: false, // set to true to use with jQuery UI themes
// styles for the message when blocking; if you wish to disable
// these and use an external stylesheet then do this in your code:
// $.blockUI.defaults.css = {};
css: {
padding: 0,
margin: 0,
width: '30%',
top: '40%',
left: '35%',
textAlign: 'center',
color: '#000',
border: '3px solid #aaa',
backgroundColor:'#fff',
cursor: 'wait'
},
// minimal style set used when themes are used
themedCSS: {
width: '30%',
top: '40%',
left: '35%'
},
// styles for the overlay
overlayCSS: {
backgroundColor: '#000',
opacity: 0.6,
cursor: 'wait'
},
// styles applied when using $.growlUI
growlCSS: {
width: '350px',
top: '10px',
left: '',
right: '10px',
border: 'none',
padding: '5px',
opacity: 0.6,
cursor: 'default',
color: '#fff',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
'border-radius': '10px'
},
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
// (hat tip to Jorge H. N. de Vasconcelos)
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
// force usage of iframe in non-IE browsers (handy for blocking applets)
forceIframe: false,
// z-index for the blocking overlay
baseZ: 1000,
// set these to true to have the message automatically centered
centerX: true, // <-- only effects element blocking (page block controlled via css above)
centerY: true,
// allow body element to be stetched in ie6; this makes blocking look better
// on "short" pages. disable if you wish to prevent changes to the body height
allowBodyStretch: true,
// enable if you want key and mouse events to be disabled for content that is blocked
bindEvents: true,
// be default blockUI will supress tab navigation from leaving blocking content
// (if bindEvents is true)
constrainTabKey: true,
// fadeIn time in millis; set to 0 to disable fadeIn on block
fadeIn: 200,
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
fadeOut: 400,
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
timeout: 0,
// disable if you don't want to show the overlay
showOverlay: true,
// if true, focus will be placed in the first available input field when
// page blocking
focusInput: true,
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
applyPlatformOpacityRules: true,
// callback method invoked when fadeIn has completed and blocking message is visible
onBlock: null,
// callback method invoked when unblocking has completed; the callback is
// passed the element that has been unblocked (which is the window object for page
// blocks) and the options that were passed to the unblock call:
// onUnblock(element, options)
onUnblock: null,
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
quirksmodeOffsetHack: 4,
// class name of the message block
blockMsgClass: 'blockMsg',
// if it is already blocked, then ignore it (don't unblock and reblock)
ignoreIfBlocked: false
};
// private data and functions follow...
var pageBlock = null;
var pageBlockEls = [];
function install(el, opts) {
var css, themedCSS;
var full = (el == window);
var msg = (opts && opts.message !== undefined ? opts.message : undefined);
opts = $.extend({}, $.blockUI.defaults, opts || {});
if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
return;
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
msg = msg === undefined ? opts.message : msg;
// remove the current block (if there is one)
if (full && pageBlock)
remove(window, {fadeOut:0});
// if an existing element is being used as the blocking content then we capture
// its current place in the DOM (and current display style) so we can restore
// it when we unblock
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
var node = msg.jquery ? msg[0] : msg;
var data = {};
$(el).data('blockUI.history', data);
data.el = node;
data.parent = node.parentNode;
data.display = node.style.display;
data.position = node.style.position;
if (data.parent)
data.parent.removeChild(node);
}
$(el).data('blockUI.onUnblock', opts.onUnblock);
var z = opts.baseZ;
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
// layer1 is the iframe layer which is used to supress bleed through of underlying content
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
// layer3 is the message content that is displayed while blocking
var lyr1 = ($.browser.msie || opts.forceIframe)
? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
: $('<div class="blockUI" style="display:none"></div>');
var lyr2 = opts.theme
? $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>')
: $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
var lyr3, s;
if (opts.theme && full) {
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
if ( opts.title ) {
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
}
s += '<div class="ui-widget-content ui-dialog-content"></div>';
s += '</div>';
}
else if (opts.theme) {
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
if ( opts.title ) {
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>'
}
s += '<div class="ui-widget-content ui-dialog-content"></div>';
s += '</div>';
}
else if (full) {
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
}
else {
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
}
lyr3 = $(s);
// if we have a message, style it
if (msg) {
if (opts.theme) {
lyr3.css(themedCSS);
lyr3.addClass('ui-widget-content');
}
else
lyr3.css(css);
}
// style the overlay
if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))))
lyr2.css(opts.overlayCSS);
lyr2.css('position', full ? 'fixed' : 'absolute');
// make iframe layer transparent in IE
if ($.browser.msie || opts.forceIframe)
lyr1.css('opacity',0.0);
//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
$.each(layers, function() {
this.appendTo($par);
});
if (opts.theme && opts.draggable && $.fn.draggable) {
lyr3.draggable({
handle: '.ui-dialog-titlebar',
cancel: 'li'
});
}
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
if (ie6 || expr) {
// give body 100% height
if (full && opts.allowBodyStretch && $.boxModel)
$('html,body').css('height','100%');
// fix ie6 issue when blocked element has a border width
if ((ie6 || !$.boxModel) && !full) {
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
var fixT = t ? '(0 - '+t+')' : 0;
var fixL = l ? '(0 - '+l+')' : 0;
}
// simulate fixed position
$.each([lyr1,lyr2,lyr3], function(i,o) {
var s = o[0].style;
s.position = 'absolute';
if (i < 2) {
full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
: s.setExpression('height','this.parentNode.offsetHeight + "px"');
full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
: s.setExpression('width','this.parentNode.offsetWidth + "px"');
if (fixL) s.setExpression('left', fixL);
if (fixT) s.setExpression('top', fixT);
}
else if (opts.centerY) {
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
s.marginTop = 0;
}
else if (!opts.centerY && full) {
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
s.setExpression('top',expression);
}
});
}
// show the message
if (msg) {
if (opts.theme)
lyr3.find('.ui-widget-content').append(msg);
else
lyr3.append(msg);
if (msg.jquery || msg.nodeType)
$(msg).show();
}
if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
lyr1.show(); // opacity is zero
if (opts.fadeIn) {
var cb = opts.onBlock ? opts.onBlock : noOp;
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
var cb2 = msg ? cb : noOp;
if (opts.showOverlay)
lyr2._fadeIn(opts.fadeIn, cb1);
if (msg)
lyr3._fadeIn(opts.fadeIn, cb2);
}
else {
if (opts.showOverlay)
lyr2.show();
if (msg)
lyr3.show();
if (opts.onBlock)
opts.onBlock();
}
// bind key and mouse events
bind(1, el, opts);
if (full) {
pageBlock = lyr3[0];
pageBlockEls = $(':input:enabled:visible',pageBlock);
if (opts.focusInput)
setTimeout(focus, 20);
}
else
center(lyr3[0], opts.centerX, opts.centerY);
if (opts.timeout) {
// auto-unblock
var to = setTimeout(function() {
full ? $.unblockUI(opts) : $(el).unblock(opts);
}, opts.timeout);
$(el).data('blockUI.timeout', to);
}
};
// remove the block
function remove(el, opts) {
var full = (el == window);
var $el = $(el);
var data = $el.data('blockUI.history');
var to = $el.data('blockUI.timeout');
if (to) {
clearTimeout(to);
$el.removeData('blockUI.timeout');
}
opts = $.extend({}, $.blockUI.defaults, opts || {});
bind(0, el, opts); // unbind events
if (opts.onUnblock === null) {
opts.onUnblock = $el.data('blockUI.onUnblock');
$el.removeData('blockUI.onUnblock');
}
var els;
if (full) // crazy selector to handle odd field errors in ie6/7
els = $('body').children().filter('.blockUI').add('body > .blockUI');
else
els = $('.blockUI', el);
if (full)
pageBlock = pageBlockEls = null;
if (opts.fadeOut) {
els.fadeOut(opts.fadeOut);
setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
}
else
reset(els, data, opts, el);
};
// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
els.each(function(i,o) {
// remove via DOM calls so we don't lose event handlers
if (this.parentNode)
this.parentNode.removeChild(this);
});
if (data && data.el) {
data.el.style.display = data.display;
data.el.style.position = data.position;
if (data.parent)
data.parent.appendChild(data.el);
$(el).removeData('blockUI.history');
}
if (typeof opts.onUnblock == 'function')
opts.onUnblock(el,opts);
};
// bind/unbind the handler
function bind(b, el, opts) {
var full = el == window, $el = $(el);
// don't bother unbinding if there is nothing to unbind
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
return;
$el.data('blockUI.isBlocked', b);
// don't bind events when overlay is not in use or if bindEvents is false
if (!opts.bindEvents || (b && !opts.showOverlay))
return;
// bind anchors and inputs for mouse and key events
var events = 'mousedown mouseup keydown keypress';
b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
// former impl...
// var $e = $('a,:input');
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
};
// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
// allow tab navigation (conditionally)
if (e.keyCode && e.keyCode == 9) {
if (pageBlock && e.data.constrainTabKey) {
var els = pageBlockEls;
var fwd = !e.shiftKey && e.target === els[els.length-1];
var back = e.shiftKey && e.target === els[0];
if (fwd || back) {
setTimeout(function(){focus(back)},10);
return false;
}
}
}
var opts = e.data;
// allow events within the message content
if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0)
return true;
// allow events for content that is not being blocked
return $(e.target).parents().children().filter('div.blockUI').length == 0;
};
function focus(back) {
if (!pageBlockEls)
return;
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
if (e)
e.focus();
};
function center(el, x, y) {
var p = el.parentNode, s = el.style;
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
if (x) s.left = l > 0 ? (l+'px') : '0';
if (y) s.top = t > 0 ? (t+'px') : '0';
};
function sz(el, p) {
return parseInt($.css(el,p))||0;
};
};
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
define(['jquery'], setup);
} else {
setup(jQuery);
}
})();

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -31,23 +31,24 @@ require_once $dolibarr_main_document_root . '/core/lib/admin.lib.php';
require_once $dolibarr_main_document_root . '/core/lib/security.lib.php'; // for dol_hash
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:'auto');
$setuplang=GETPOST("selectlang",'',3)?GETPOST("selectlang",'',3):'auto';
$langs->setDefaultLang($setuplang);
$versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($argv[1])?'':$argv[1]);
$versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]);
$action=GETPOST('action', 'alpha');
// Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install
// or MAIN_VERSION_LAST_UPGRADE for upgrade.
$targetversion=DOL_VERSION; // It it's last upgrade
if (isset($_POST["action"]) && preg_match('/upgrade/i',$_POST["action"])) // If it's an old upgrade
if (! empty($action) && preg_match('/upgrade/i', $action)) // If it's an old upgrade
{
$tmp=explode('_',$_POST["action"],2);
$tmp=explode('_', $action, 2);
if ($tmp[0]=='upgrade' && ! empty($tmp[1])) $targetversion=$tmp[1];
}
$langs->load("admin");
$langs->load("install");
$action=GETPOST('action');
$success=0;
// Init "forced values" to nothing. "forced values" are used after using an install wizard (using a file install.forced.php).
@ -105,14 +106,14 @@ pHeader($langs->trans("SetupEnd"),"etape5");
print '<br>';
// Test if we can run a first install process
if (! GETPOST("versionfrom") && ! GETPOST("versionto") && ! is_writable($conffile))
if (empty($versionfrom) && empty($versionto) && ! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",$conffiletoshow);
pFooter(1,$setuplang,'jscheckparam');
exit;
}
if ($action == "set" || preg_match('/upgrade/i',$action))
if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
{
print '<table cellspacing="0" cellpadding="2" width="100%">';
$error=0;
@ -250,7 +251,7 @@ if ($action == "set" || preg_match('/upgrade/i',$action))
}
}
// If upgrade
elseif (preg_match('/upgrade/i',$action))
elseif (empty($action) || preg_match('/upgrade/i',$action))
{
if ($db->connected == 1)
{
@ -355,7 +356,7 @@ if ($action == "set")
}
}
// If upgrade
elseif (preg_match('/upgrade/i',$action))
elseif (empty($action) || preg_match('/upgrade/i',$action))
{
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION))
{

View File

@ -190,8 +190,8 @@ INSERT INTO llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) VALUE
INSERT INTO llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) VALUES (2023, 202, '0', '0', 'VAT Rate 0', 1);
-- SPAIN (id country=4)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 41, 4, '18','0','4','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 42, 4, '8','0','1','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 41, 4, '21','0','5.2','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 42, 4, '10','0','1.4','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 43, 4, '4','0','0.5','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 44, 4, '0','0','VAT Rate 0',1);

View File

@ -37,7 +37,7 @@ update llx_commande set fk_user_author = null where fk_user_author not in (selec
update llx_commande set fk_user_valid = null where fk_user_valid not in (select rowid from llx_user);
ALTER TABLE llx_extrafields ADD COLUMN TYPE VARCHAR(8);
ALTER TABLE llx_extrafields ADD COLUMN type VARCHAR(8);
UPDATE llx_c_paper_format SET active=1 WHERE active=0;
@ -455,8 +455,6 @@ ALTER TABLE llx_facture_fourn ADD COLUMN extraparams varchar(255) AFTER import_k
ALTER TABLE llx_boxes ADD COLUMN maxline integer NULL;
ALTER TABLE llx_commande_fournisseur ADD COLUMN date_livraison date NULL;
ALTER TABLE llx_product_fournisseur_price MODIFY fk_product_fournisseur integer DEFAULT 0;
UPDATE llx_product SET canvas = NULL where canvas = 'default@product';

View File

@ -7,7 +7,7 @@
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60);
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To restrict request to Mysql version x.y use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y use -- VPGSQLx.y
@ -43,8 +43,8 @@ ALTER TABLE llx_mailing MODIFY COLUMN body mediumtext;
ALTER TABLE llx_mailing ADD COLUMN extraparams varchar(255);
ALTER TABLE llx_product MODIFY ref varchar(128) NOT NULL;
ALTER TABLE llx_product MODIFY ref_ext varchar(128);
ALTER TABLE llx_product MODIFY COLUMN ref varchar(128) NOT NULL;
ALTER TABLE llx_product MODIFY COLUMN ref_ext varchar(128);
ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur;
ALTER TABLE llx_product_fournisseur_price ADD charges DOUBLE( 24, 8 ) DEFAULT 0 AFTER unitprice;
@ -64,9 +64,9 @@ alter table llx_propaldet drop column pa_ht;
alter table llx_propaldet drop column marge_tx;
alter table llx_propaldet drop column marque_tx;
ALTER TABLE llx_commande CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL;
ALTER TABLE llx_propal CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL;
ALTER TABLE llx_commande_fournisseur CHANGE fk_methode_commande fk_input_method INT(11) NULL DEFAULT 0;
ALTER TABLE llx_commande CHANGE COLUMN fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL;
ALTER TABLE llx_propal CHANGE COLUMN fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL;
ALTER TABLE llx_commande_fournisseur CHANGE COLUMN fk_methode_commande fk_input_method INT(11) NULL DEFAULT 0;
INSERT INTO llx_const (name, value, type, note, visible) values ('PRODUCT_CODEPRODUCT_ADDON','mod_codeproduct_leopard','yesno','Module to control product codes',0);
@ -84,3 +84,42 @@ ALTER TABLE llx_facturedet_rec ADD COLUMN label varchar(255) DEFAULT NULL AFTER
ALTER TABLE llx_accountingaccount ADD COLUMN active tinyint DEFAULT 1 NOT NULL AFTER label;
ALTER TABLE llx_actioncomm MODIFY elementtype VARCHAR(32);
-- TASK #107
ALTER TABLE llx_ecm_directories MODIFY COLUMN label varchar(64) NOT NULL;
ALTER TABLE llx_ecm_directories ADD COLUMN acl text;
ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c);
ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m);
ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_c FOREIGN KEY (fk_user_c) REFERENCES llx_user (rowid);
ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_m FOREIGN KEY (fk_user_m) REFERENCES llx_user (rowid);
ALTER TABLE llx_ecm_documents DROP INDEX idx_ecm_documents;
ALTER TABLE llx_ecm_documents DROP COLUMN manualkeyword;
ALTER TABLE llx_ecm_documents DROP COLUMN fullpath_orig;
ALTER TABLE llx_ecm_documents DROP COLUMN private;
ALTER TABLE llx_ecm_documents DROP COLUMN crc;
ALTER TABLE llx_ecm_documents DROP COLUMN cryptkey;
ALTER TABLE llx_ecm_documents DROP COLUMN cipher;
ALTER TABLE llx_ecm_documents CHANGE COLUMN fullpath_dol fullpath varchar(255) NOT NULL;
ALTER TABLE llx_ecm_documents MODIFY COLUMN filemime varchar(128) NOT NULL;
ALTER TABLE llx_ecm_documents ADD COLUMN metadata text after description;
ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity);
ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create);
ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update);
ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_directory FOREIGN KEY (fk_directory) REFERENCES llx_ecm_directories (rowid);
ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_create FOREIGN KEY (fk_create) REFERENCES llx_user (rowid);
ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_update FOREIGN KEY (fk_update) REFERENCES llx_user (rowid);
create table llx_element_tag
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
lang varchar(5) NOT NULL,
tag varchar(255) NOT NULL,
fk_element integer NOT NULL,
element varchar(64) NOT NULL
)ENGINE=innodb;
ALTER TABLE llx_element_tag ADD UNIQUE INDEX uk_element_tag (entity, lang, tag, fk_element, element);
-- END TASK #107

View File

@ -51,6 +51,8 @@ UPDATE llx_product SET canvas = NULL where canvas = 'default@product';
DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def);
DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery';
-- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid
-- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note)

View File

@ -1,5 +1,6 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
--
-- 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
@ -18,4 +19,8 @@
ALTER TABLE llx_ecm_directories ADD UNIQUE INDEX idx_ecm_directories (label, fk_parent, entity);
ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c);
ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m);
ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_c FOREIGN KEY (fk_user_c) REFERENCES llx_user (rowid);
ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_m FOREIGN KEY (fk_user_m) REFERENCES llx_user (rowid);

View File

@ -1,6 +1,6 @@
-- ===================================================================
-- Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
--
-- 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
@ -21,14 +21,16 @@
create table llx_ecm_directories
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(32) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_parent integer,
description varchar(255) NOT NULL,
cachenbofdoc integer NOT NULL DEFAULT 0,
date_c datetime,
date_m timestamp,
fk_user_c integer,
fk_user_m integer
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(64) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_parent integer,
description varchar(255) NOT NULL,
cachenbofdoc integer NOT NULL DEFAULT 0,
date_c datetime,
date_m timestamp,
fk_user_c integer,
fk_user_m integer,
acl text
) ENGINE=innodb;

View File

@ -1,5 +1,6 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
--
-- 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
@ -17,5 +18,11 @@
-- ============================================================================
ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents (fullpath_dol);
ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity);
ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create);
ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update);
ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_directory FOREIGN KEY (fk_directory) REFERENCES llx_ecm_directories (rowid);
ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_create FOREIGN KEY (fk_create) REFERENCES llx_user (rowid);
ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_update FOREIGN KEY (fk_update) REFERENCES llx_user (rowid);

View File

@ -1,6 +1,6 @@
-- ===================================================================
-- Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
--
-- 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
@ -20,24 +20,20 @@
create table llx_ecm_documents
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(16) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
filename varchar(255) NOT NULL,
filesize integer NOT NULL,
filemime varchar(32) NOT NULL,
fullpath_dol varchar(255) NOT NULL,
fullpath_orig varchar(255) NOT NULL,
description text,
manualkeyword text,
fk_create integer NOT NULL,
fk_update integer,
date_c datetime NOT NULL,
date_u timestamp,
fk_directory integer,
fk_status smallint DEFAULT 0,
private smallint DEFAULT 0,
crc varchar(32) NOT NULL DEFAULT '', -- checksum
cryptkey varchar(50) NOT NULL DEFAULT '', -- crypt key
cipher varchar(50) NOT NULL DEFAULT 'twofish' -- crypt cipher
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(16) NOT NULL,
entity integer DEFAULT 1 NOT NULL,
filename varchar(255) NOT NULL,
filesize integer NOT NULL,
filemime varchar(128) NOT NULL,
description text,
metadata text,
fullpath varchar(255) NOT NULL,
fk_directory integer,
fk_create integer NOT NULL,
fk_update integer,
date_c datetime NOT NULL,
date_u timestamp,
fk_status smallint DEFAULT 0
) ENGINE=innodb;

View File

@ -0,0 +1,20 @@
-- ============================================================================
-- Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ============================================================================
ALTER TABLE llx_element_tag ADD UNIQUE INDEX uk_element_tag (entity, lang, tag, fk_element, element);

View File

@ -0,0 +1,29 @@
-- ============================================================================
-- Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===========================================================================
create table llx_element_tag
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
lang varchar(5) NOT NULL,
tag varchar(255) NOT NULL,
fk_element integer NOT NULL,
element varchar(64) NOT NULL
)ENGINE=innodb;

View File

@ -48,7 +48,8 @@ $versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($arg
$versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]);
$langs->load("admin");
$langs->load("install");
$langs->load("install");
$langs->load("errors");
if ($dolibarr_main_db_type == "mysql") $choix=1;
if ($dolibarr_main_db_type == "mysqli") $choix=1;
@ -152,79 +153,96 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
print '<tr><td>'.$langs->trans("ServerVersion").'</td>';
print '<td align="right">'.$version.'</td></tr>';
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerVersion")." : $version");
//print '<td align="right">'.join('.',$versionarray).'</td></tr>';
// Test database version
$versionmindb=getStaticMember(get_class($db),'versionmin');
//print join('.',$versionarray).' - '.join('.',$versionmindb);
if (count($versionmindb) && count($versionarray)
&& versioncompare($versionarray,$versionmindb) < 0)
{
// Warning: database version too low.
print "<tr><td>".$langs->trans("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb)));
$ok=0;
}
}
// Force l'affichage de la progression
print '<tr><td colspan="2">'.$langs->trans("PleaseBePatient").'</td></tr>';
flush();
if ($ok)
{
print '<tr><td colspan="2">'.$langs->trans("PleaseBePatient").'</td></tr>';
flush();
}
/*
* Delete duplicates in table categorie_association
*/
$couples=array();
$filles=array();
$sql = "SELECT fk_categorie_mere, fk_categorie_fille";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association";
dolibarr_install_syslog("upgrade: search duplicate sql=".$sql);
$resql = $db->query($sql);
if ($resql)
if ($ok)
{
$num=$db->num_rows($resql);
while ($obj=$db->fetch_object($resql))
{
if (! isset($filles[$obj->fk_categorie_fille])) // Only one record as child (a child has only on parent).
{
if ($obj->fk_categorie_mere != $obj->fk_categorie_fille)
{
$filles[$obj->fk_categorie_fille]=1; // Set record for this child
$couples[$obj->fk_categorie_mere.'_'.$obj->fk_categorie_fille]=array('mere'=>$obj->fk_categorie_mere, 'fille'=>$obj->fk_categorie_fille);
}
}
}
$couples=array();
$filles=array();
$sql = "SELECT fk_categorie_mere, fk_categorie_fille";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association";
dolibarr_install_syslog("upgrade: search duplicate sql=".$sql);
$resql = $db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
while ($obj=$db->fetch_object($resql))
{
if (! isset($filles[$obj->fk_categorie_fille])) // Only one record as child (a child has only on parent).
{
if ($obj->fk_categorie_mere != $obj->fk_categorie_fille)
{
$filles[$obj->fk_categorie_fille]=1; // Set record for this child
$couples[$obj->fk_categorie_mere.'_'.$obj->fk_categorie_fille]=array('mere'=>$obj->fk_categorie_mere, 'fille'=>$obj->fk_categorie_fille);
}
}
}
dolibarr_install_syslog("upgrade: result is num=".$num." count(couples)=".count($couples));
dolibarr_install_syslog("upgrade: result is num=".$num." count(couples)=".count($couples));
// If there is duplicates couples or child with two parents
if (count($couples) > 0 && $num > count($couples))
{
$error=0;
// If there is duplicates couples or child with two parents
if (count($couples) > 0 && $num > count($couples))
{
$error=0;
$db->begin();
$db->begin();
$sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association";
dolibarr_install_syslog("upgrade: delete association sql=".$sql);
$resqld=$db->query($sql);
if ($resqld)
{
foreach($couples as $key => $val)
{
$sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)";
$sql.=" VALUES(".$val['mere'].", ".$val['fille'].")";
dolibarr_install_syslog("upgrade: insert association sql=".$sql);
$resqli=$db->query($sql);
if (! $resqli) $error++;
}
}
$sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association";
dolibarr_install_syslog("upgrade: delete association sql=".$sql);
$resqld=$db->query($sql);
if ($resqld)
{
foreach($couples as $key => $val)
{
$sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)";
$sql.=" VALUES(".$val['mere'].", ".$val['fille'].")";
dolibarr_install_syslog("upgrade: insert association sql=".$sql);
$resqli=$db->query($sql);
if (! $resqli) $error++;
}
}
if (! $error)
{
print '<tr><td>'.$langs->trans("RemoveDuplicates").'</td>';
print '<td align="right">'.$langs->trans("Success").' ('.$num.'=>'.count($couples).')</td></tr>';
$db->commit();
}
else
{
print '<tr><td>'.$langs->trans("RemoveDuplicates").'</td>';
print '<td align="right">'.$langs->trans("Failed").'</td></tr>';
$db->rollback();
}
}
}
else
{
print '<div class="error">'.$langs->trans("Error").'</div>';
if (! $error)
{
print '<tr><td>'.$langs->trans("RemoveDuplicates").'</td>';
print '<td align="right">'.$langs->trans("Success").' ('.$num.'=>'.count($couples).')</td></tr>';
$db->commit();
}
else
{
print '<tr><td>'.$langs->trans("RemoveDuplicates").'</td>';
print '<td align="right">'.$langs->trans("Failed").'</td></tr>';
$db->rollback();
}
}
}
else
{
print '<div class="error">'.$langs->trans("Error").'</div>';
}
}
/*
@ -232,7 +250,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
*/
if ($ok && preg_match('/mysql/',$db->type))
{
$versioncommande=explode('.','4.0');
$versioncommande=array(4,0,0);
if (count($versioncommande) && count($versionarray)
&& versioncompare($versioncommande,$versionarray) <= 0) // Si mysql >= 4.0
{
@ -292,11 +310,15 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{
$dir = "mysql/migration/"; // We use mysql migration scripts whatever is database driver
// For minor version
$newversionfrom=preg_replace('/(\.[0-9]+)$/i','.0',$versionfrom);
$newversionto=preg_replace('/(\.[0-9]+)$/i','.0',$versionto);
$filelist=array();
$i = 0;
$ok = 0;
$from='^'.$versionfrom;
$to=$versionto.'\.sql$';
$from='^'.$newversionfrom;
$to=$newversionto.'\.sql$';
// Get files list
$filesindir=array();

View File

@ -4,14 +4,8 @@ Accountancy=Λογιστική
AccountancyCard=Καρτέλα λογιστικής
Treasury=Περιουσιακά
MenuFinancial=Οικονομικά
TaxModuleSetupToModifyRules=Go to <a href="%s">module setup</a> to modify rules for calculation
OptionMode=Επιλογές λογιστικής
OptionModeTrue=Επιλογές εσόδων-εξόδων
OptionModeVirtual=Option Credits-Debits
OptionModeTrueDesc=In this context, the turnover is calculated over payments (date of payments). \nThe validity of the figures is assured only if the book-keeping is scrutinized through the input/output on the accounts via invoices.
OptionModeVirtualDesc=In this context, the turnover is calculated over invoices (date of validation). When these invoices are due, whether they have been paid or not, they are listed in the turnover output.
FeatureIsSupportedInInOutModeOnly=Feature only available in CREDITS-DEBTS accountancy mode (See Accountancy module configuration)
VATReportBuildWithOptionDefinedInModule=Amounts shown here are calculated using rules defined by Tax module setup.
Param=Παραμετροποίηση
AccountsGeneral=Λογαριασμοί
Account=Λογαριασμός

View File

@ -8,7 +8,7 @@ TaxModuleSetupToModifyRules=Go to <a href="%s">module setup</a> to modify rules
OptionMode=Option for accountancy
OptionModeTrue=Option Incomes-Expenses
OptionModeVirtual=Option Claims-Debts
OptionModeTrueDesc=In this context, the turnover is calculated over payments (date of payments). \nThe validity of the figures is assured only if the book-keeping is scrutinized through the input/output on the accounts via invoices.
OptionModeTrueDesc=In this context, the turnover is calculated over payments (date of payments). The validity of the figures is assured only if the book-keeping is scrutinized through the input/output on the accounts via invoices.
OptionModeVirtualDesc=In this context, the turnover is calculated over invoices (date of validation). When these invoices are due, whether they have been paid or not, they are listed in the turnover output.
FeatureIsSupportedInInOutModeOnly=Feature only available in CREDITS-DEBTS accountancy mode (See Accountancy module configuration)
VATReportBuildWithOptionDefinedInModule=Amounts shown here are calculated using rules defined by Tax module setup.

View File

@ -26,6 +26,7 @@ ErrorGoBackAndCorrectParameters=Go backward and correct wrong parameters.
ErrorWrongValueForParameter=You may have typed a wrong value for parameter '%s'.
ErrorFailedToCreateDatabase=Failed to create database '%s'.
ErrorFailedToConnectToDatabase=Failed to connect to database '%s'.
ErrorDatabaseVersionTooLow=Database version (%s) too old. Version %s or higher is required.
ErrorPHPVersionTooLow=PHP version too old. Version %s is required.
WarningPHPVersionTooLow=PHP version too old. Version %s or more is expected. This version should allow install but is not supported.
ErrorConnectedButDatabaseNotFound=Connection to server successfull but database '%s' not found.

View File

@ -169,6 +169,7 @@ AddFiles=Add Files
StartUpload=Start upload
CancelUpload=Cancel upload
FileIsTooBig=Files is too big
PleaseBePatient=Please be patient...
##### Calendar common #####
AddCalendarEntry=Add entry in calendar %s

View File

@ -26,6 +26,7 @@ ErrorGoBackAndCorrectParameters=Revenez en arrière et corrigez les paramètres
ErrorWrongValueForParameter=Vous avez peut-être saisi une mauvaise valeur pour le paramètre '%s'.
ErrorFailedToCreateDatabase=Echec de création de la base '%s'.
ErrorFailedToConnectToDatabase=Echec de connexion à la base '%s'.
ErrorDatabaseVersionTooLow=Version de base de donnée (%s) trop ancienne. La version %s ou supérieure est requise.
ErrorPHPVersionTooLow=Version de PHP trop ancienne. La version %s est requise.
WarningPHPVersionTooLow=Version de PHP trop ancienne. La version %s ou plus est recommandée. Cette version reste utilisable mais n'est pas supportée.
ErrorConnectedButDatabaseNotFound=Connexion au serveur réussi mais base '%s' introuvable.

View File

@ -168,6 +168,8 @@ AddFiles=Ajouter des fichiers
StartUpload=Transférer
CancelUpload=Annuler le transfert
FileIsTooBig=Le fichier est trop volumineux
PleaseBePatient=Merci de patienter quelques instants...
##### Calendar common #####
AddCalendarEntry=Ajouter entrée dans le calendrier %s
NewCompanyToDolibarr=Société %s ajoutée dans Dolibarr

View File

@ -937,7 +937,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="http://www.dolibarr.org">'."\n";
// Output standard javascript links
if (! $disablejs && $conf->use_javascript_ajax)
if (! $disablejs && ! empty($conf->use_javascript_ajax))
{
$ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) {
@ -963,6 +963,12 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/jnotify.js"></script>'."\n";
}
// jQuery blockUI
if (! empty($conf->global->MAIN_USE_JQUERY_BLOCKUI))
{
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/blockUI/jquery.blockUI.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/blockUI.js"></script>'."\n";
}
// Flot
if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT))
{
@ -1000,7 +1006,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js"></script>'."\n";
}
// jQuery File Upload
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD))
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || (defined('REQUIRE_JQUERY_FILEUPLOAD') && constant('REQUIRE_JQUERY_FILEUPLOAD')))
{
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/template/tmpl.min.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.iframe-transport.js"></script>'."\n";

View File

@ -363,6 +363,7 @@ class Product extends CommonObject
{
// Product already exists with this ref
$langs->load("products");
$error++;
$this->error = "ErrorProductAlreadyExists";
}
}

View File

@ -436,7 +436,7 @@ abstract class ActionsCardCommon
$res=dol_include_once($dirroot.$module.'.php');
if ($res) break;
}
$modCodeClient = new $module;
$modCodeClient = new $module($db);
$this->tpl['auto_customercode'] = $modCodeClient->code_auto;
// We verified if the tag prefix is used
if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
@ -714,4 +714,4 @@ abstract class ActionsCardCommon
}
?>
?>

View File

@ -1013,7 +1013,7 @@ else
$res=dol_include_once($dirroot.$module.'.php');
if ($res) break;
}
$modCodeClient = new $module;
$modCodeClient = new $module($db);
// We verified if the tag prefix is used
if ($modCodeClient->code_auto)
{
@ -1031,7 +1031,7 @@ else
$res=dol_include_once($dirroot.$module.'.php');
if ($res) break;
}
$modCodeFournisseur = new $module;
$modCodeFournisseur = new $module($db);
// On verifie si la balise prefix est utilisee
if ($modCodeFournisseur->code_auto)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View File

@ -35,6 +35,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
session_cache_limiter(FALSE);
require_once '../../main.inc.php';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -33,11 +33,31 @@ print '<head>
print '<!-- Includes for JQuery (Ajax library) -->'."\n";
if (constant('JS_JQUERY_UI')) print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
else print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui-latest.custom.css" />'."\n"; // JQuery
// CSS forced by modules (relative url starting with /)
if (isset($conf->modules_parts['css']))
{
$arraycss=(array) $conf->modules_parts['css'];
foreach($arraycss as $modcss => $filescss)
{
$filescss=(array) $filescss; // To be sure filecss is an array
foreach($filescss as $cssfile)
{
// cssfile is a relative path
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '"><!-- Added by module '.$modcss. '-->'."\n";
}
}
}
// JQuery. Must be before other includes
$ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
print '<!-- Includes JS for JQuery -->'."\n";
if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
print '<link rel="stylesheet" type="text/css" href="'.$conf_css.'" />
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/dst.js"></script>'."\n";
print '<link rel="stylesheet" type="text/css" href="'.dol_escape_htmltag($conf_css).'" />
<style type="text/css">
<!--
#login {
@ -61,140 +81,9 @@ print '<!-- HTTP_USER_AGENT = '.$_SERVER['HTTP_USER_AGENT'].' -->
<!-- Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second -->
<script type="text/javascript">
function DisplayDstSwitchDates(firstsecond)
{
var year = new Date().getYear();
if (year < 1000) year += 1900;
var firstSwitch = 0;
var secondSwitch = 0;
var lastOffset = 99;
// Loop through every month of the current year
for (i = 0; i < 12; i++)
{
// Fetch the timezone value for the month
var newDate = new Date(Date.UTC(year, i, 0, 0, 0, 0, 0));
var tz = -1 * newDate.getTimezoneOffset() / 60;
// Capture when a timzezone change occurs
if (tz > lastOffset)
firstSwitch = i-1;
else if (tz < lastOffset)
secondSwitch = i-1;
lastOffset = tz;
}
// Go figure out date/time occurences a minute before
// a DST adjustment occurs
var secondDstDate = FindDstSwitchDate(year, secondSwitch);
var firstDstDate = FindDstSwitchDate(year, firstSwitch);
if (firstsecond == 'first') return firstDstDate;
if (firstsecond == 'second') return secondDstDate;
if (firstDstDate == null && secondDstDate == null)
return 'Daylight Savings is not observed in your timezone.';
else
return 'Last minute before DST change occurs in ' +
year + ': ' + firstDstDate + ' and ' + secondDstDate;
}
function FindDstSwitchDate(year, month)
{
// Set the starting date
var baseDate = new Date(Date.UTC(year, month, 0, 0, 0, 0, 0));
var changeDay = 0;
var changeMinute = -1;
var baseOffset = -1 * baseDate.getTimezoneOffset() / 60;
var dstDate;
// Loop to find the exact day a timezone adjust occurs
for (day = 0; day < 50; day++)
{
var tmpDate = new Date(Date.UTC(year, month, day, 0, 0, 0, 0));
var tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;
// Check if the timezone changed from one day to the next
if (tmpOffset != baseOffset)
{
var minutes = 0;
changeDay = day;
// Back-up one day and grap the offset
tmpDate = new Date(Date.UTC(year, month, day-1, 0, 0, 0, 0));
tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;
// Count the minutes until a timezone chnage occurs
while (changeMinute == -1)
{
tmpDate = new Date(Date.UTC(year, month, day-1, 0, minutes, 0, 0));
tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;
// Determine the exact minute a timezone change
// occurs
if (tmpOffset != baseOffset)
{
// Back-up a minute to get the date/time just
// before a timezone change occurs
tmpOffset = new Date(Date.UTC(year, month,
day-1, 0, minutes-1, 0, 0));
changeMinute = minutes;
break;
}
else
minutes++;
}
// Add a month (for display) since JavaScript counts
// months from 0 to 11
dstDate = tmpOffset.getMonth() + 1;
// Pad the month as needed
if (dstDate < 10) dstDate = "0" + dstDate;
// Add the day and year
dstDate = year + '-' + dstDate + '-' + tmpOffset.getDate() + 'T';
// Capture the time stamp
tmpDate = new Date(Date.UTC(year, month,
day-1, 0, minutes-1, 0, 0));
dstDate += tmpDate.toTimeString().split(' ')[0] + 'Z';
return dstDate;
}
}
}
jQuery(document).ready(function () {
$(document).ready(function () {
// Set focus on correct field
<?php if ($focus_element) { ?>jQuery('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
// Detect and save TZ and DST
var rightNow = new Date();
var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
var temp = jan1.toGMTString();
var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60);
var june1 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0);
temp = june1.toGMTString();
var june2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
var daylight_time_offset = (june1 - june2) / (1000 * 60 * 60);
var dst;
if (std_time_offset == daylight_time_offset) {
dst = "0"; // daylight savings time is NOT observed
} else {
dst = "1"; // daylight savings time is observed
}
var dst_first=DisplayDstSwitchDates('first');
var dst_second=DisplayDstSwitchDates('second');
//alert(dst);
jQuery('#tz').val(std_time_offset); // returns TZ
jQuery('#dst_observed').val(dst); // returns if DST is observed on summer
jQuery('#dst_first').val(dst_first); // returns DST first switch in year
jQuery('#dst_second').val(dst_second); // returns DST second switch in year
// Detect and save screen resolution
jQuery('#screenwidth').val(jQuery(window).width()); // returns width of browser viewport
jQuery('#screenheight').val(jQuery(window).height()); // returns width of browser viewport
<?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
});
</script>
@ -203,11 +92,14 @@ jQuery(document).ready(function () {
<input type="hidden" name="loginfunction" value="loginfunction" />
<!-- Add fields to send local user information -->
<input type="hidden" name="tz" id="tz" value="" />
<input type="hidden" name="tz_string" id="tz_string" value="" />
<input type="hidden" name="dst_observed" id="dst_observed" value="" />
<input type="hidden" name="dst_first" id="dst_first" value="" />
<input type="hidden" name="dst_second" id="dst_second" value="" />
<input type="hidden" name="screenwidth" id="screenwidth" value="" />
<input type="hidden" name="screenheight" id="screenheight" value="" />
<input type="hidden" name="dol_hide_topmenu" id="dol_hide_topmenu" value="" />
<input type="hidden" name="dol_hide_leftmenu" id="dol_hide_leftmenu" value="" />
<div id="infoVersion"><?php echo $title; ?></div>
@ -220,9 +112,17 @@ jQuery(document).ready(function () {
<div id="logBox"><strong><label for="username"><?php echo $langs->trans('Login'); ?></label></strong><input type="text" id="username" name="username" class="flat" size="15" maxlength="40" value="<?php echo GETPOST('username')?GETPOST('username'):$login; ?>" tabindex="1" /></div>
<div id="passBox"><strong><label for="password"><?php echo $langs->trans('Password'); ?></label></strong><input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="<?php echo $password; ?>" tabindex="2" /></div>
<?php if ($select_entity) { ?>
<div><strong><?php echo $langs->trans('Entity'); ?></strong><?php echo $select_entity; ?></div>
<?php } ?>
<?php
if (! empty($hookmanager->resArray['options'])) {
foreach ($hookmanager->resArray['options'] as $format => $option)
{
if ($format == 'div') {
echo '<!-- Option by hook -->';
echo $option;
}
}
}
?>
<?php if ($captcha) { ?>
<div class="captchaBox">

View File

@ -34,11 +34,30 @@ print '<head>
print '<!-- Includes for JQuery (Ajax library) -->'."\n";
if (constant('JS_JQUERY_UI')) print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
else print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui-latest.custom.css" />'."\n"; // JQuery
// CSS forced by modules (relative url starting with /)
if (isset($conf->modules_parts['css']))
{
$arraycss=(array) $conf->modules_parts['css'];
foreach($arraycss as $modcss => $filescss)
{
$filescss=(array) $filescss; // To be sure filecss is an array
foreach($filescss as $cssfile)
{
// cssfile is a relative path
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '"><!-- Added by module '.$modcss. '-->'."\n";
}
}
}
// JQuery. Must be before other includes
$ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
print '<!-- Includes JS for JQuery -->'."\n";
if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
print '<link rel="stylesheet" type="text/css" href="'.$conf_css.'" />'."\n";
print '<link rel="stylesheet" type="text/css" href="'.dol_escape_htmltag($conf_css).'" />'."\n";
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER;
print '<!-- HTTP_USER_AGENT = '.$_SERVER['HTTP_USER_AGENT'].' -->
</head>';
@ -57,13 +76,22 @@ print '<!-- HTTP_USER_AGENT = '.$_SERVER['HTTP_USER_AGENT'].' -->
</div>
<div id="parameterBox">
<div id="logBox"><strong><label for="username"><?php echo $langs->trans('Login'); ?></label></strong><input type="text" <?php echo $disabled; ?> id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></div>
<div id="logBox">
<strong><label for="username"><?php echo $langs->trans('Login'); ?></label></strong>
<input type="text" <?php echo $disabled; ?> id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" />
</div>
<?php if ($select_entity) { ?>
<div><?php echo $langs->trans('Entity'); ?> &nbsp;
<?php echo $select_entity; ?>
</div>
<?php } ?>
<?php
if (! empty($hookmanager->resArray['options'])) {
foreach ($hookmanager->resArray['options'] as $format => $option)
{
if ($format == 'div') {
echo '<!-- Option by hook -->';
echo $option;
}
}
}
?>
<?php if ($captcha) { ?>
<div class="captchaBox">

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View File

@ -1761,13 +1761,6 @@ div.error {
background: #EFCFCF;
}
div.jnotify-background {
opacity : 0.95 !important;
-moz-box-shadow: 4px 4px 4px #888 !important;
-webkit-box-shadow: 4px 4px 4px #888 !important;
box-shadow: 4px 4px 4px #888 !important;
}
/* Info admin */
div.info {
color: #807050;
@ -2509,6 +2502,32 @@ div.ecmjqft {
padding-right: 10px !important;
}
/* use or not ? */
div.jnotify-background {
opacity : 0.95 !important;
-moz-box-shadow: 4px 4px 4px #888 !important;
-webkit-box-shadow: 4px 4px 4px #888 !important;
box-shadow: 4px 4px 4px #888 !important;
}
/* ============================================================================== */
/* blockUI */
/* ============================================================================== */
/*div.growlUI { background: url(check48.png) no-repeat 10px 10px }*/
div.dolEventValid h1, div.dolEventValid h2 {
color: #567b1b;
background-color: #e3f0db;
padding: 5px 5px 5px 5px;
text-align: left;
}
div.dolEventError h1, div.dolEventError h2 {
color: #a72947;
background-color: #d79eac;
padding: 5px 5px 5px 5px;
text-align: left;
}
/* ============================================================================== */
/* Maps */
/* ============================================================================== */

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008-2011 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008-2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -27,7 +27,8 @@ define("NOLOGIN",1); // This means this output page does not require to be logge
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
if ($conf->ldap->enabled) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
if (! empty($conf->ldap->enabled))
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
$langs->load("errors");
$langs->load("users");
@ -42,7 +43,7 @@ if ($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)
exit;
}
$action=GETPOST('action');
$action=GETPOST('action', 'alpha');
$mode=$dolibarr_main_authentication;
if (! $mode) $mode='http';
@ -50,6 +51,14 @@ $username = GETPOST('username');
$passwordmd5 = GETPOST('passwordmd5');
$conf->entity = (GETPOST('entity') ? GETPOST('entity') : 1);
// Instantiate hooks of thirdparty module only if not already define
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
}
$hookmanager->initHooks(array('passwordforgottenpage'));
/**
* Actions
@ -167,6 +176,9 @@ else
$conf->css = "/theme/".$conf->theme."/style.css.php?lang=".$langs->defaultlang;
$conf_css = DOL_URL_ROOT.$conf->css;
$jquerytheme = 'smoothness';
if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
{
$login_background = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png';
@ -190,52 +202,34 @@ $rowspan=2;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
}
elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode($mysoc->logo);
$width=128;
}elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png'))
{
$urllogo=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png';
}elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
{
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode($mysoc->logo);
$width=128;
}
// Entity combobox
$select_entity='';
if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX) && ! $disabled)
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png'))
{
$rowspan++;
$lastuser='';
$lastentity = GETPOST('entity');
if (! empty($conf->global->MULTICOMPANY_COOKIE_ENABLED))
{
$prefix=dol_getprefix();
$entityCookieName = 'DOLENTITYID_'.$prefix;
if (isset($_COOKIE[$entityCookieName]))
{
include_once DOL_DOCUMENT_ROOT . '/core/class/cookie.class.php';
$lastuser = ''; $lastentity = '';
$entityCookie = new DolCookie($conf->file->cookie_cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName);
list($lastuser, $lastentity) = explode('|', $cookieValue);
}
}
$select_entity = $mc->select_entities($lastentity, 'entity', ' tabindex="2"');
$urllogo=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png';
}
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
{
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
}
// Security graphical code
if (function_exists("imagecreatefrompng") && ! $disabled)
{
$captcha = 1;
$captcha_refresh = img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"');
$captcha = 1;
$captcha_refresh = img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"');
}
// Execute hook getPasswordForgottenPageOptions
// Should be an array with differents options in $hookmanager->resArray
$parameters=array('entity' => GETPOST('entity','int'));
$hookmanager->executeHooks('getPasswordForgottenPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks
include $template_dir.'passwordforgotten.tpl.php'; // To use native PHP
?>