Merge remote branch 'upstream/develop' into custom

Conflicts:
	htdocs/custom/.gitignore
This commit is contained in:
frederic34 2015-01-16 23:09:43 +01:00
commit 52a1e8a0f3
42 changed files with 412 additions and 396 deletions

View File

@ -8,7 +8,8 @@ For users:
- New: Use new combobox. - New: Use new combobox.
- New: Add hidden option MAXTABS_IN_CARD. - New: Add hidden option MAXTABS_IN_CARD.
- Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined' - Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined'
- Add Weighted average price as default price for buying price for margin calculation. Add option
MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
For translators: For translators:
- Update language files. - Update language files.
@ -188,6 +189,8 @@ Dolibarr better:
***** ChangeLog for 3.6.3 compared to 3.6.2 ***** ***** ChangeLog for 3.6.3 compared to 3.6.2 *****
- Fix: ref_ext was not saved when recording a customer order from web service - Fix: ref_ext was not saved when recording a customer order from web service
- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
***** ChangeLog for 3.6.2 compared to 3.6.1 ***** ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.

View File

@ -171,7 +171,7 @@ $message.='<br>';
print $message; print $message;
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>'; $message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>'; //$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>'; $message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>'; $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login); $message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);

View File

@ -348,18 +348,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$commande->type=0; $commande->type=0;
$nextval=$module->getNextValue($mysoc,$commande); $nextval=$module->getNextValue($mysoc,$commande);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{ $htmltooltip.=''.$langs->trans("NextValue").': ';
$htmltooltip.=''.$langs->trans("NextValue").': '; if ($nextval) {
if ($nextval) if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
{ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else $htmltooltip.=$langs->trans($module->error).'<br>';
{ }
$htmltooltip.=$langs->trans($module->error).'<br>'; }
}
}
print '<td align="center">'; print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0); print $form->textwithpicto('',$htmltooltip,1,0);

View File

@ -299,18 +299,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$contract); $nextval=$module->getNextValue($mysoc,$contract);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{ $htmltooltip.=''.$langs->trans("NextValue").': ';
$htmltooltip.=''.$langs->trans("NextValue").': '; if ($nextval) {
if ($nextval) if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
{ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else $htmltooltip.=$langs->trans($module->error).'<br>';
{ }
$htmltooltip.=$langs->trans($module->error).'<br>'; }
}
}
print '<td align="center">'; print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0); print $form->textwithpicto('',$htmltooltip,1,0);

View File

@ -324,18 +324,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$expedition); $nextval=$module->getNextValue($mysoc,$expedition);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{ $htmltooltip.=''.$langs->trans("NextValue").': ';
$htmltooltip.=''.$langs->trans("NextValue").': '; if ($nextval) {
if ($nextval) if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
{ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else $htmltooltip.=$langs->trans($module->error).'<br>';
{ }
$htmltooltip.=$langs->trans($module->error).'<br>'; }
}
}
print '<td align="center">'; print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0); print $form->textwithpicto('',$htmltooltip,1,0);

View File

@ -393,61 +393,53 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0; $facture->type=0;
$nextval=$module->getNextValue($mysoc,$facture); $nextval=$module->getNextValue($mysoc,$facture);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{
$htmltooltip.=$langs->trans("NextValueForInvoices").': '; $htmltooltip.=$langs->trans("NextValueForInvoices").': ';
if ($nextval) if ($nextval) {
{ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else
{
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip.=$langs->trans($module->error).'<br>';
} }
} }
// Example for remplacement // Example for remplacement
$facture->type=1; $facture->type=1;
$nextval=$module->getNextValue($mysoc,$facture); $nextval=$module->getNextValue($mysoc,$facture);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{ $htmltooltip.=$langs->trans("NextValueForReplacements").': ';
$htmltooltip.=$langs->trans("NextValueForReplacements").': '; if ($nextval) {
if ($nextval) if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
{ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else $htmltooltip.=$langs->trans($module->error).'<br>';
{ }
$htmltooltip.=$langs->trans($module->error).'<br>';
}
} }
// Example for credit invoice // Example for credit invoice
$facture->type=2; $facture->type=2;
$nextval=$module->getNextValue($mysoc,$facture); $nextval=$module->getNextValue($mysoc,$facture);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{
$htmltooltip.=$langs->trans("NextValueForCreditNotes").': '; $htmltooltip.=$langs->trans("NextValueForCreditNotes").': ';
if ($nextval) if ($nextval) {
{ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else
{
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip.=$langs->trans($module->error).'<br>';
} }
} }
// Example for deposit invoice // Example for deposit invoice
$facture->type=3; $facture->type=3;
$nextval=$module->getNextValue($mysoc,$facture); $nextval=$module->getNextValue($mysoc,$facture);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{
$htmltooltip.=$langs->trans("NextValueForDeposit").': '; $htmltooltip.=$langs->trans("NextValueForDeposit").': ';
if ($nextval) if ($nextval) {
{ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval; $htmltooltip.=$nextval;
} } else {
else
{
$htmltooltip.=$langs->trans($module->error); $htmltooltip.=$langs->trans($module->error);
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* *
@ -328,10 +328,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$ficheinter); $nextval=$module->getNextValue($mysoc,$ficheinter);
if ($nextval != $langs->trans("NotAvailable")) if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{ $htmltooltip.=''.$langs->trans("NextValue").': ';
$htmltooltip.=''.$langs->trans("NextValue").': '.$nextval; if ($nextval) {
} if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>';
} else {
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">'; print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0); print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>'; print '</td>';

View File

@ -309,15 +309,13 @@ foreach ($dirmodels as $reldir)
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$livraison); $nextval=$module->getNextValue($mysoc,$livraison);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': '; $htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) if ($nextval) {
{ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else
{
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip.=$langs->trans($module->error).'<br>';
} }
} }

View File

@ -344,18 +344,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$propal->type=0; $propal->type=0;
$nextval=$module->getNextValue($mysoc,$propal); $nextval=$module->getNextValue($mysoc,$propal);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{ $htmltooltip.=''.$langs->trans("NextValue").': ';
$htmltooltip.=''.$langs->trans("NextValue").': '; if ($nextval) {
if ($nextval) if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
{ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else $htmltooltip.=$langs->trans($module->error).'<br>';
{ }
$htmltooltip.=$langs->trans($module->error).'<br>'; }
}
}
print '<td align="center">'; print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0); print $form->textwithpicto('',$htmltooltip,1,0);

View File

@ -278,15 +278,13 @@ foreach ($dirmodels as $reldir)
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$invoice); $nextval=$module->getNextValue($mysoc,$invoice);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': '; $htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) if ($nextval) {
{ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else
{
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip.=$langs->trans($module->error).'<br>';
} }
} }

View File

@ -279,15 +279,13 @@ foreach ($dirmodels as $reldir)
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$commande); $nextval=$module->getNextValue($mysoc,$commande);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': '; $htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) if ($nextval) {
{ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} } else {
else
{
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip.=$langs->trans($module->error).'<br>';
} }
} }

View File

@ -278,7 +278,7 @@ if ($socid)
// Address // Address
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">';
print dol_print_address($soc->address,'gmap','thirdparty',$object->id); print dol_print_address($soc->address,'gmap','thirdparty',$soc->id);
print '</td></tr>'; print '</td></tr>';
// Zip / Town // Zip / Town

View File

@ -141,6 +141,9 @@ class ActionComm extends CommonObject
$userownerid=$this->userownerid; $userownerid=$this->userownerid;
$userdoneid=$this->userdoneid; $userdoneid=$this->userdoneid;
// Be sure assigned user array is not empty.
if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$userownerid);
if (! $this->type_id || ! $this->type_code) if (! $this->type_id || ! $this->type_code)
{ {
$key=empty($this->type_id)?$this->type_code:$this->type_id; $key=empty($this->type_id)?$this->type_code:$this->type_id;
@ -973,7 +976,7 @@ class ActionComm extends CommonObject
$sql.= " a.label, a.code, a.note, a.fk_action as type_id,"; $sql.= " a.label, a.code, a.note, a.fk_action as type_id,";
$sql.= " a.fk_soc,"; $sql.= " a.fk_soc,";
$sql.= " a.fk_user_author, a.fk_user_mod,"; $sql.= " a.fk_user_author, a.fk_user_mod,";
$sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_user_action,";
$sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_contact, a.percent as percentage,";
$sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_element, a.elementtype,";
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
@ -981,9 +984,11 @@ class ActionComm extends CommonObject
$sql.= " s.nom as socname,"; $sql.= " s.nom as socname,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " c.id as type_id, c.code as type_code, c.libelle";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
$sql.= " WHERE a.fk_action=c.id"; // We must filter on assignement table
if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
$sql.= " WHERE a.fk_action=c.id";
$sql.= " AND a.entity = ".$conf->entity; $sql.= " AND a.entity = ".$conf->entity;
foreach ($filters as $key => $value) foreach ($filters as $key => $value)
{ {
@ -993,17 +998,8 @@ class ActionComm extends CommonObject
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0); if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0); if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0); if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
if ($key == 'login') // We must filter on assignement table
{ if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
$login=$value;
$userforfilter=new User($this->db);
$result=$userforfilter->fetch('',$value);
$sql.= " AND (";
$sql.= " a.fk_user_author = ".$userforfilter->id;
$sql.= " OR a.fk_user_action = ".$userforfilter->id;
$sql.= " OR a.fk_user_done = ".$userforfilter->id;
$sql.= ")";
}
if ($key == 'logina') if ($key == 'logina')
{ {
$logina=$value; $logina=$value;
@ -1011,19 +1007,12 @@ class ActionComm extends CommonObject
$result=$userforfilter->fetch('',$value); $result=$userforfilter->fetch('',$value);
$sql.= " AND a.fk_user_author = ".$userforfilter->id; $sql.= " AND a.fk_user_author = ".$userforfilter->id;
} }
if ($key == 'logint') if ($key == 'logint' || $key == 'login')
{ {
$logint=$value; $logint=$value;
$userforfilter=new User($this->db); $userforfilter=new User($this->db);
$result=$userforfilter->fetch('',$value); $result=$userforfilter->fetch('',$value);
$sql.= " AND a.fk_user_action = ".$userforfilter->id; $sql.= " AND ar.fk_element = ".$userforfilter->id;
}
if ($key == 'logind')
{
$logind=$value;
$userforfilter=new User($this->db);
$result=$userforfilter->fetch('',$value);
$sql.= " AND a.fk_user_done = ".$userforfilter->id;
} }
} }
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import $sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import

View File

@ -40,9 +40,7 @@ if (! empty($conf->projet->enabled)) {
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter=GETPOST("filter",'',3); $filter=GETPOST("filter",'',3);
$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@ -72,9 +70,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden();
if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read) $canedit=0;
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
{ {
$filtera=$user->id;
$filtert=$user->id; $filtert=$user->id;
$filterd=$user->id;
} }
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
@ -283,9 +279,7 @@ $param='';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
if ($filter) $param.="&filter=".$filter; if ($filter) $param.="&filter=".$filter;
if ($filtera) $param.="&filtera=".$filtera;
if ($filtert) $param.="&filtert=".$filtert; if ($filtert) $param.="&filtert=".$filtert;
if ($filterd) $param.="&filterd=".$filterd;
if ($socid) $param.="&socid=".$socid; if ($socid) $param.="&socid=".$socid;
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&showbirthday=1";
if ($pid) $param.="&projectid=".$pid; if ($pid) $param.="&projectid=".$pid;
@ -340,7 +334,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
$head = calendars_prepare_head($paramnoaction); $head = calendars_prepare_head($paramnoaction);
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
dol_fiche_end(); dol_fiche_end();
$showextcals=$listofextcals; $showextcals=$listofextcals;
@ -405,27 +399,29 @@ print_fiche_titre($s,$link.' &nbsp; &nbsp; '.$nav, '');
// Get event in an array // Get event in an array
$eventarray=array(); $eventarray=array();
$sql = 'SELECT a.id,a.label,'; $sql = 'SELECT ';
if ($usergroup > 0) $sql.=" DISTINCT";
$sql.= ' a.id, a.label,';
$sql.= ' a.datep,'; $sql.= ' a.datep,';
$sql.= ' a.datep2,'; $sql.= ' a.datep2,';
$sql.= ' a.datea,';
$sql.= ' a.datea2,';
$sql.= ' a.percent,'; $sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; $sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact,'; $sql.= ' a.fk_soc, a.fk_contact,';
$sql.= ' ca.code as type_code, ca.libelle as type_label'; $sql.= ' ca.code as type_code, ca.libelle as type_label';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; // We must filter on assignement table
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
$sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' WHERE a.fk_action = ca.id';
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
// FIXME: We must filter on assignement table // We must filter on assignement table
if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($action == 'show_day') if ($action == 'show_day')
{ {
$sql.= " AND ("; $sql.= " AND (";
@ -459,14 +455,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
// FIXME: We must filter on assignement table // We must filter on assignement table
if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) if ($filtert > 0 || $usergroup > 0)
{ {
$sql.= " AND ("; $sql.= " AND (";
if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")"; $sql.= ")";
} }
// Sort on date // Sort on date
@ -1094,7 +1088,7 @@ $db->close();
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60) function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form
global $theme_datacolor; global $theme_datacolor;
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
@ -1383,7 +1377,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
{ {
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year; print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year;
print ($status?'&status='.$status:'').($filter?'&filter='.$filter:''); print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
print ($filtera?'&filtera='.$filtera:'').($filtert?'&filtert='.$filtert:'').($filterd?'&filterd='.$filterd:''); print ($filtert?'&filtert='.$filtert:'');
print ($actioncode!=''?'&actioncode='.$actioncode:''); print ($actioncode!=''?'&actioncode='.$actioncode:'');
print '">'.img_picto("all","1downarrow_selected.png").' ...'; print '">'.img_picto("all","1downarrow_selected.png").' ...';
print ' +'.(count($eventarray[$daykey])-$maxprint); print ' +'.(count($eventarray[$daykey])-$maxprint);

View File

@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
$langs->load("users");
$langs->load("companies"); $langs->load("companies");
$langs->load("agenda"); $langs->load("agenda");
$langs->load("commercial"); $langs->load("commercial");
@ -52,9 +53,7 @@ if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $s
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
$filter=GETPOST("filter",'',3); $filter=GETPOST("filter",'',3);
$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@ -94,9 +93,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden();
if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read) $canedit=0;
if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permission to see all, we show only affected to me if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permission to see all, we show only affected to me
{ {
$filtera=$user->id;
$filtert=$user->id; $filtert=$user->id;
$filterd=$user->id;
} }
// Purge search criteria // Purge search criteria
@ -133,15 +130,14 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
*/ */
$form=new Form($db); $form=new Form($db);
$userstatic=new User($db);
$nav=''; $nav='';
$nav.=' &nbsp; <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">'; $nav.=' &nbsp; <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">'; if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">';
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">'; if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
if ($filtera) $nav.='<input type="hidden" name="filtera" value="'.$filtera.'">';
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
if ($filterd) $nav.='<input type="hidden" name="filterd" value="'.$filterd.'">';
if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">'; if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">';
if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">'; if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
@ -163,65 +159,57 @@ $param='';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
if ($filter) $param.="&filter=".$filter; if ($filter) $param.="&filter=".$filter;
if ($filtera) $param.="&filtera=".$filtera;
if ($filtert) $param.="&filtert=".$filtert; if ($filtert) $param.="&filtert=".$filtert;
if ($filterd) $param.="&filterd=".$filterd;
if ($socid) $param.="&socid=".$socid; if ($socid) $param.="&socid=".$socid;
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&showbirthday=1";
if ($pid) $param.="&projectid=".$pid; if ($pid) $param.="&projectid=".$pid;
if ($type) $param.="&type=".$type; if ($type) $param.="&type=".$type;
if ($usergroup) $param.="&usergroup=".$usergroup; if ($usergroup) $param.="&usergroup=".$usergroup;
$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql = "SELECT";
$sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; if ($usergroup > 0) $sql.=" DISTINCT";
$sql.= " a.fk_contact, a.note, a.label, a.percent as percent,"; $sql.= " s.nom as societe, s.rowid as socid, s.client,";
$sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,";
$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= " a.fk_contact, a.note, a.percent as percent,";
$sql.= " c.code as type_code, c.libelle as type_label,"; $sql.= " c.code as type_code, c.libelle as type_label,";
$sql.= " ua.login as loginauthor, ua.rowid as useridauthor,";
$sql.= " ut.login as logintodo, ut.rowid as useridtodo,";
//$sql.= " ud.login as logindone, ud.rowid as useriddone,";
$sql.= " sp.lastname, sp.firstname"; $sql.= " sp.lastname, sp.firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " ".MAIN_DB_PREFIX.'user as u,';
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON a.fk_user_author = ua.rowid"; // We must filter on assignement table
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid"; if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid"; if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
$sql.= " WHERE c.id = a.fk_action"; $sql.= " WHERE c.id = a.fk_action";
$sql.= ' AND a.fk_user_author = u.rowid';
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
if ($actioncode) $sql.=" AND c.code='".$db->escape($actioncode)."'"; if ($actioncode) $sql.=" AND c.code='".$db->escape($actioncode)."'";
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid; if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
// FIXME: We must filter on assignement table // We must filter on assignement table
if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($type) $sql.= " AND c.id = ".$type; if ($type) $sql.= " AND c.id = ".$type;
if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '0') { $sql.= " AND a.percent = 0"; }
if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
// FIXME: We must filter on assignement table // We must filter on assignement table
if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) if ($filtert > 0 || $usergroup > 0)
{ {
$sql.= " AND ("; $sql.= " AND (";
if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")"; $sql.= ")";
} }
// The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case) // The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case)
if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))"; if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))";
if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'"; if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'";
if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'";
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset); $sql.= $db->plimit($limit + 1, $offset);
//print $sql; //print $sql;
dol_syslog("comm/action/listactions.php", LOG_DEBUG); dol_syslog("comm/action/listactions.php", LOG_DEBUG);
@ -246,7 +234,7 @@ if ($resql)
$head = calendars_prepare_head($param); $head = calendars_prepare_head($param);
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,-1,$actioncode,$usergroup); print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup);
dol_fiche_end(); dol_fiche_end();
// Add link to show birthdays // Add link to show birthdays
@ -275,14 +263,11 @@ if ($resql)
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
@ -375,46 +360,16 @@ if ($resql)
} }
print '</td>'; print '</td>';
// User author
/*
print '<td align="left">';
if ($obj->useridauthor)
{
$userstatic=new User($db);
$userstatic->id=$obj->useridauthor;
$userstatic->login=$obj->loginauthor;
print $userstatic->getLoginUrl(1);
}
else print '&nbsp;';
print '</td>';
*/
// User to do // User to do
print '<td align="left">'; print '<td align="left">';
if ($obj->useridtodo) if ($obj->fk_user_action > 0)
{ {
$userstatic=new User($db); $userstatic->fetch($obj->fk_user_action);
$userstatic->id=$obj->useridtodo;
$userstatic->login=$obj->logintodo;
print $userstatic->getLoginUrl(1); print $userstatic->getLoginUrl(1);
} }
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
// User did
/*
print '<td align="left">';
if ($obj->useriddone)
{
$userstatic=new User($db);
$userstatic->id=$obj->useriddone;
$userstatic->login=$obj->logindone;
print $userstatic->getLoginUrl(1);
}
else print '&nbsp;';
print '</td>';
*/
// Status/Percent // Status/Percent
print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>'; print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
@ -434,6 +389,6 @@ else
} }
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -39,9 +39,7 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter=GETPOST("filter",'',3); $filter=GETPOST("filter",'',3);
$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id; //if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; //$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@ -73,9 +71,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden();
if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read) $canedit=0;
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
{ {
$filtera=$user->id;
$filtert=$user->id; $filtert=$user->id;
$filterd=$user->id;
} }
//$action=GETPOST('action','alpha'); //$action=GETPOST('action','alpha');
@ -130,6 +126,7 @@ if (GETPOST('viewday') || $action == 'show_day') {
} // View by day } // View by day
$langs->load("users");
$langs->load("agenda"); $langs->load("agenda");
$langs->load("other"); $langs->load("other");
$langs->load("commercial"); $langs->load("commercial");
@ -198,9 +195,7 @@ $param='';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
if ($filter) $param.="&filter=".$filter; if ($filter) $param.="&filter=".$filter;
if ($filtera) $param.="&filtera=".$filtera;
if ($filtert) $param.="&filtert=".$filtert; if ($filtert) $param.="&filtert=".$filtert;
if ($filterd) $param.="&filterd=".$filterd;
if ($usergroup) $param.="&usergroup=".$usergroup; if ($usergroup) $param.="&usergroup=".$usergroup;
if ($socid) $param.="&socid=".$socid; if ($socid) $param.="&socid=".$socid;
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&showbirthday=1";
@ -280,7 +275,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
$head = calendars_prepare_head($paramnoaction); $head = calendars_prepare_head($paramnoaction);
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup); print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
dol_fiche_end(); dol_fiche_end();
$showextcals=$listofextcals; $showextcals=$listofextcals;
@ -332,27 +327,29 @@ print_fiche_titre($s,$link.' &nbsp; &nbsp; '.$nav, '');
// Get event in an array // Get event in an array
$eventarray=array(); $eventarray=array();
$sql = 'SELECT a.id,a.label,'; $sql = 'SELECT';
if ($usergroup > 0) $sql.=" DISTINCT";
$sql.= ' a.id, a.label,';
$sql.= ' a.datep,'; $sql.= ' a.datep,';
$sql.= ' a.datep2,'; $sql.= ' a.datep2,';
$sql.= ' a.datea,';
$sql.= ' a.datea2,';
$sql.= ' a.percent,'; $sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; $sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,'; $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
$sql.= ' ca.code, ca.color'; $sql.= ' ca.code, ca.color';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; // We must filter on assignement table
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
$sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' WHERE a.fk_action = ca.id';
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
// FIXME: We must filter on assignement table // We must filter on assignement table
if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($action == 'show_day') if ($action == 'show_day')
{ {
$sql.= " AND ("; $sql.= " AND (";
@ -386,14 +383,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
// FIXME: We must filter on assignement table // We must filter on assignement table
if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) if ($filtert > 0 || $usergroup > 0)
{ {
$sql.= " AND ("; $sql.= " AND (";
if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")"; $sql.= ")";
} }
// Sort on date // Sort on date
@ -679,7 +674,7 @@ foreach ($usernames as $username)
{ {
$var = ! $var; $var = ! $var;
echo "<tr>"; echo "<tr>";
echo '<td class="cal_current_month"'.($var?' style="background: #F8F8F8"':'').'>' . $username->getNomUrl(1). '</td>'; echo '<td class="cal_current_month cal_peruserviewname"'.($var?' style="background: #F8F8F8"':'').'>' . $username->getNomUrl(1). '</td>';
$tmpday = $sav; $tmpday = $sav;
// Lopp on each day of week // Lopp on each day of week
@ -809,7 +804,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
{ {
global $db; global $db;
global $user, $conf, $langs, $hookmanager, $action; global $user, $conf, $langs, $hookmanager, $action;
global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form global $filter, $filtert, $status, $actioncode; // Filters used into search form
global $theme_datacolor; // Array with a list of different we can use (come from theme) global $theme_datacolor; // Array with a list of different we can use (come from theme)
global $cachethirdparties, $cachecontacts, $colorindexused; global $cachethirdparties, $cachecontacts, $colorindexused;
global $begin_h, $end_h; global $begin_h, $end_h;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
@ -893,29 +893,30 @@ class BonPrelevement extends CommonObject
*/ */
if (!$error) if (!$error)
{ {
$ref = "T".substr($year,-2).$month; $ref = substr($year,-2).$month;
$sql = "SELECT count(*)"; $sql = "SELECT substring(ref from char_length(ref) - 1)";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
$sql.= " WHERE ref LIKE '".$ref."%'"; $sql.= " WHERE ref LIKE '%".$ref."%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " ORDER BY ref DESC LIMIT 1";
dol_syslog(get_class($this)."::Create", LOG_DEBUG); dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
} }
else else
{ {
$error++; $error++;
dol_syslog("Erreur recherche reference"); dol_syslog("Erreur recherche reference");
} }
$ref = $ref . substr("00".($row[0]+1), -2); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1),2,"0",STR_PAD_LEFT);
$filebonprev = $ref; $filebonprev = $ref;
// Create withdraw receipt in database // Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";

View File

@ -27,7 +27,7 @@
*/ */
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
@ -186,27 +186,13 @@ function displayBox($selectedDate,$month,$year)
</tr> </tr>
<tr class="dpDayNames"> <tr class="dpDayNames">
<?php <?php
$startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; $first_day_of_week = isset($conf->global->MAIN_START_WEEK) ? (int) $conf->global->MAIN_START_WEEK : 0;
if($startday==1) $day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday');
{?> for( $i=0; $i < 7; $i++ )
<td width="14%"><?php echo $langs->trans("ShortMonday") ?></td> {
<td width="15%"><?php echo $langs->trans("ShortTuesday") ?></td> echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $first_day_of_week) % 7]), '</td>', "\n";
<td width="14%"><?php echo $langs->trans("ShortWednesday") ?></td> }
<td width="15%"><?php echo $langs->trans("ShortThursday") ?></td> ?>
<td width="14%"><?php echo $langs->trans("ShortFriday") ?></td>
<td width="14%"><?php echo $langs->trans("ShortSaturday") ?></td>
<td width="14%"><?php echo $langs->trans("ShortSunday") ?></td>
<?php
}else {?>
<td width="14%"><?php echo $langs->trans("ShortSunday") ?></td>
<td width="14%"><?php echo $langs->trans("ShortMonday") ?></td>
<td width="15%"><?php echo $langs->trans("ShortTuesday") ?></td>
<td width="14%"><?php echo $langs->trans("ShortWednesday") ?></td>
<td width="15%"><?php echo $langs->trans("ShortThursday") ?></td>
<td width="14%"><?php echo $langs->trans("ShortFriday") ?></td>
<td width="14%"><?php echo $langs->trans("ShortSaturday") ?></td>
<?php
}?>
</tr> </tr>
<?php <?php
//print "x ".$thedate." y"; //print "x ".$thedate." y";
@ -222,7 +208,7 @@ function displayBox($selectedDate,$month,$year)
{ {
echo "<TR class=\"dpWeek\">"; echo "<TR class=\"dpWeek\">";
$cols=0; $cols=0;
for($i=0;$i< $mydate["wday"];$i++) for($i=0;$i< ($mydate["wday"]+7-$first_day_of_week)%7;$i++)
{ {
echo "<TD>&nbsp;</TD>"; echo "<TD>&nbsp;</TD>";
$cols++; $cols++;
@ -230,7 +216,7 @@ function displayBox($selectedDate,$month,$year)
} }
else else
{ {
if ($mydate["wday"]==0) if ($mydate["wday"]==$first_day_of_week)
{ {
echo "<TR class=\"dpWeek\">"; echo "<TR class=\"dpWeek\">";
$cols=0; $cols=0;
@ -254,7 +240,7 @@ function displayBox($selectedDate,$month,$year)
echo ">".sprintf("%02s",$mydate["mday"])."</TD>"; echo ">".sprintf("%02s",$mydate["mday"])."</TD>";
$cols++; $cols++;
if ($mydate["wday"]==6) echo "</TR>\n"; if ($mydate != $firstdate && $mydate["wday"]==(($first_day_of_week + 6)%7)) echo "</TR>\n";
//$thedate=strtotime("tomorrow",$thedate); //$thedate=strtotime("tomorrow",$thedate);
$day++; $day++;

View File

@ -70,7 +70,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
{ {
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("ActionsOwnedBy").' &nbsp; '; print $langs->trans("ActionsToDoBy").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">'; print '</td><td class="nowrap maxwidthonsmartphone">';
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("Group").' &nbsp; '; if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("Group").' &nbsp; ';

View File

@ -659,7 +659,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
*/ */
function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0) function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0)
{ {
global $conf; global $conf,$langs;
$out="\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n"; $out="\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
@ -751,8 +751,9 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
if ($displaytab > $limittoshow) if ($displaytab > $limittoshow)
{ {
$out.='<div id=moretabs class="inline-block tabsElem"><a href="" data-role="button" style="background-color: #f0f0f0;" class="tab inline-block">Plus</a>'; $out.='<div id="moretabs" class="inline-block tabsElem">';
$out.='<div id=moretabsList style="position: absolute; left: -999em;text-align: left;margin:0px;padding:2px">'.$outmore.'</div></div>'; $out.='<a href="" data-role="button" style="background-color: #f0f0f0;" class="tab inline-block">'.$langs->trans("More").'...</a>';
$out.='<div id="moretabsList" style="position: absolute; left: -999em;text-align: left;margin:0px;padding:2px">'.$outmore.'</div>';
$out.="</div>\n"; $out.="</div>\n";
$out.="<script>"; $out.="<script>";
@ -761,6 +762,8 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
$out.="</script>"; $out.="</script>";
} }
$out.="</div>\n";
if (! $notab) $out.="\n".'<div class="tabBar">'."\n"; if (! $notab) $out.="\n".'<div class="tabBar">'."\n";
return $out; return $out;
@ -844,7 +847,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
else if (in_array($object->country_code,array('ES','TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country else if (in_array($object->country_code,array('ES','TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country
{ {
$ret .= ($ret ? $sep : '' ).$object->zip; $ret .= ($ret ? $sep : '' ).$object->zip;
$ret .= ' '.$object->town; $ret .= ($object->town?' '.$object->town:'');
if ($object->state && in_array($object->country_code,$countriesusingstate)) if ($object->state && in_array($object->country_code,$countriesusingstate))
{ {
$ret.="\n".$object->state; $ret.="\n".$object->state;
@ -854,14 +857,14 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
else // Other: title firstname name \n address lines \n zip town \n country else // Other: title firstname name \n address lines \n zip town \n country
{ {
$ret .= ($ret ? $sep : '' ).$object->zip; $ret .= ($ret ? $sep : '' ).$object->zip;
$ret .= ' '.$object->town; $ret .= ($object->town?' '.$object->town:'');
if ($object->state && in_array($object->country_code,$countriesusingstate)) if ($object->state && in_array($object->country_code,$countriesusingstate))
{ {
$ret.=", ".$object->state; $ret.=", ".$object->state;
} }
} }
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):''); if ($withcountry) $ret.=($object->country_code?($ret?$sep:'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
return $ret; return $ret;
} }
@ -4630,6 +4633,7 @@ function dol_eval($s,$returnvalue=0)
global $leftmenu; global $leftmenu;
global $rights; global $rights;
global $object; global $object;
global $soc;
//print $s."<br>\n"; //print $s."<br>\n";
if ($returnvalue) return @eval('return '.$s.';'); if ($returnvalue) return @eval('return '.$s.';');

View File

@ -608,7 +608,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$maskraz=-1; $maskraz=-1;
$maskoffset=0; $maskoffset=0;
$resetEveryMonth=false; $resetEveryMonth=false;
if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter // Extract value for third party mask counter
if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef)) if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef))
@ -620,7 +620,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask $maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask
$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
$maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like $maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like
if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
} }
else $maskrefclient=''; else $maskrefclient='';
@ -628,8 +628,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if (preg_match('/\{(t+)\}/i',$mask,$regType)) if (preg_match('/\{(t+)\}/i',$mask,$regType))
{ {
$masktype=$regType[1]; $masktype=$regType[1];
$masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));//get n first characters of client code where n is length in mask $masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));// get n first characters of thirdpaty typent_code (where n is length in mask)
$masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); $masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask
} }
else else
{ {
@ -650,7 +650,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
// Now maskwithnocode = 0000ddmmyyyyccc for example // Now maskwithnocode = 0000ddmmyyyyccc for example
// and maskcounter = 0000 for example // and maskcounter = 0000 for example
//print "maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n<br>"; //print "maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n<br>";
//var_dump($reg); //var_dump($reg);
// If an offset is asked // If an offset is asked
if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]); if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]);
@ -667,17 +667,16 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
//print "yearoffset=".$yearoffset." yearoffsettype=".$yearoffsettype; //print "yearoffset=".$yearoffset." yearoffsettype=".$yearoffsettype;
if (is_numeric($yearoffsettype) && $yearoffsettype >= 1) if (is_numeric($yearoffsettype) && $yearoffsettype >= 1)
$maskraz=$yearoffsettype; // For backward compatibility $maskraz=$yearoffsettype; // For backward compatibility
else if ($yearoffsettype === '0' || (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $conf->global->SOCIETE_FISCAL_MONTH_START > 1)) else if ($yearoffsettype === '0' || (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $conf->global->SOCIETE_FISCAL_MONTH_START > 1))
$maskraz = $conf->global->SOCIETE_FISCAL_MONTH_START; $maskraz = $conf->global->SOCIETE_FISCAL_MONTH_START;
//print "maskraz=".$maskraz; // -1=no reset //print "maskraz=".$maskraz; // -1=no reset
if ($maskraz > 0) // A reset is required if ($maskraz > 0) { // A reset is required
{ if ($maskraz == 99) {
if ($maskraz == 99) { $maskraz = date('m', $date);
$maskraz = date('m', $date); $resetEveryMonth = true;
$resetEveryMonth = true; }
}
if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth';
// Define posy, posm and reg // Define posy, posm and reg
@ -964,7 +963,7 @@ function check_value($mask,$value)
$maskcounter=$reg[1]; $maskcounter=$reg[1];
$maskraz=-1; $maskraz=-1;
$maskoffset=0; $maskoffset=0;
if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter // Extract value for third party mask counter
if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef)) if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef))
@ -976,7 +975,7 @@ function check_value($mask,$value)
$maskrefclient_clientcode=substr('',0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode $maskrefclient_clientcode=substr('',0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode
$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
$maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like $maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like
if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
} }
else $maskrefclient=''; else $maskrefclient='';

View File

@ -354,7 +354,7 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname,
if ($showmode == 1) if ($showmode == 1)
{ {
print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>'; print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>'; print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>'; print '</a>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>'; print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<span class="mainmenuaspan">'; print '<span class="mainmenuaspan">';

View File

@ -483,7 +483,8 @@ jQuery(document).ready(function() {
} }
if (this.id == 'pmpprice') if (this.id == 'pmpprice')
{ {
if (this.price > 0 && 1 == 1) { defaultkey = this.id; defaultprice = this.price; } var defaultbuyprice = <?php echo (isset($conf->global->MARGIN_PMP_AS_DEFAULT_BUY_PRICE)?int($conf->global->MARGIN_PMP_AS_DEFAULT_BUY_PRICE):1); ?>;
if (this.price > 0 && 1 == defaultbuyprice) { defaultkey = this.id; defaultprice = this.price; }
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>'; options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
} }
}); });

View File

@ -2,4 +2,3 @@
!.gitignore !.gitignore
!README.md !README.md
!index.html !index.html

View File

@ -28,6 +28,7 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$idprod=GETPOST('idprod','int'); $idprod=GETPOST('idprod','int');
@ -43,8 +44,11 @@ top_httphead();
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n"; //print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
if (! empty($idprod)) if ($idprod > 0)
{ {
$producttmp=new ProductFournisseur($db);
$producttmp->fetch($idprod);
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,"; $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
$sql.= " pfp.ref_fourn,"; $sql.= " pfp.ref_fourn,";
$sql.= " pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice, pfp.charges, pfp.unitcharges,"; $sql.= " pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice, pfp.charges, pfp.unitcharges,";
@ -111,6 +115,7 @@ if (! empty($idprod))
if ($objp->duration) $label .= " - ".$objp->duration; if ($objp->duration) $label .= " - ".$objp->duration;
$label = price($price,0,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit"); $label = price($price,0,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit");
if ($objp->ref_fourn) $label.=' ('.$objp->ref_fourn.')';
$prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title); $prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title);
$i++; $i++;
@ -121,9 +126,8 @@ if (! empty($idprod))
} }
// Add price for pmp // Add price for pmp
$price=123; $price=$producttmp->pmp;
$prices[] = array("id" => 'pmpprice', "price" => $price, "label" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency)); $prices[] = array("id" => 'pmpprice', "price" => $price, "label" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency));
} }
echo json_encode($prices); echo json_encode($prices);

View File

@ -153,6 +153,9 @@ ALTER TABLE llx_projet_task_time ADD COLUMN task_datehour datetime after task_da
ALTER TABLE llx_actioncomm_resources CHANGE COLUMN transparent transparency smallint default 1; ALTER TABLE llx_actioncomm_resources CHANGE COLUMN transparent transparency smallint default 1;
ALTER TABLE llx_actioncomm_resources DROP INDEX idx_actioncomm_resources_idx1;
ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX uk_actioncomm_resources(fk_actioncomm, element_type, fk_element);
-- Localtaxes by thirds -- Localtaxes by thirds
ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10); ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10);

View File

@ -18,7 +18,7 @@
-- ============================================================================ -- ============================================================================
ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX idx_actioncomm_resources_idx1 (fk_actioncomm, element_type, fk_element); ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX uk_actioncomm_resources(fk_actioncomm, element_type, fk_element);
ALTER TABLE llx_actioncomm_resources ADD INDEX idx_actioncomm_resources_fk_element (fk_element); ALTER TABLE llx_actioncomm_resources ADD INDEX idx_actioncomm_resources_fk_element (fk_element);
-- Pas de contrainte sur fk_source et fk_target car pointe sur differentes tables -- Pas de contrainte sur fk_source et fk_target car pointe sur differentes tables

View File

@ -362,6 +362,8 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$beforeversionarray=explode('.','3.7.9'); // target is before this $beforeversionarray=explode('.','3.7.9'); // target is before this
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{ {
migrate_event_assignement($db,$langs,$conf);
// Reload modules (this must be always and only into last targeted version) // Reload modules (this must be always and only into last targeted version)
$listofmodule=array( $listofmodule=array(
'MAIN_MODULE_AGENDA', 'MAIN_MODULE_AGENDA',
@ -391,6 +393,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$db->commit(); $db->commit();
$db->close(); $db->close();
// Actions for all version (not in database) // Actions for all version (not in database)
migrate_delete_old_files($db,$langs,$conf); migrate_delete_old_files($db,$langs,$conf);
@ -3519,6 +3522,83 @@ function migrate_categorie_association($db,$langs,$conf)
print '</td></tr>'; print '</td></tr>';
} }
/**
* Migrate event assignement to owner
*
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
* @param Conf $conf Object conf
* @return void
*/
function migrate_event_assignement($db,$langs,$conf)
{
print '<tr><td colspan="4">';
print '<br>';
print '<b>'.$langs->trans('MigrationEvents')."</b><br>\n";
$error = 0;
dolibarr_install_syslog("upgrade2::migrate_event_assignement");
$db->begin();
$sqlSelect = "SELECT a.id, a.fk_user_action";
$sqlSelect.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sqlSelect.= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type = 'user' AND ar.fk_element = a.fk_user_action";
$sqlSelect.= " WHERE fk_user_action > 0 AND fk_user_action NOT IN (SELECT fk_element FROM ".MAIN_DB_PREFIX."actioncomm_resources as ar WHERE ar.fk_actioncomm = a.id AND ar.element_type = 'user')";
$sqlSelect.= " ORDER BY a.id";
//print $sqlSelect;
$resql = $db->query($sqlSelect);
if ($resql)
{
$i = 0;
$num = $db->num_rows($resql);
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$sqlUpdate = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element) ";
$sqlUpdate.= "VALUES(".$obj->id.", 'user', ".$obj->fk_user_action.")";
$result=$db->query($sqlUpdate);
if (! $result)
{
$error++;
dol_print_error($db);
}
print ". ";
$i++;
}
}
else
{
print $langs->trans('AlreadyDone')."<br>\n";
}
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
}
else
{
dol_print_error($db);
$db->rollback();
}
print '</td></tr>';
}
/** /**
* Migration directory * Migration directory
* *

View File

@ -68,7 +68,7 @@ DateActionDoneEnd= Real end date
DateActionStart= Start date DateActionStart= Start date
DateActionEnd= End date DateActionEnd= End date
AgendaUrlOptions1=You can also add following parameters to filter output: AgendaUrlOptions1=You can also add following parameters to filter output:
AgendaUrlOptions2=<b>login=%s</b> to restrict output to actions created by, assigned to or done by user <b>%s</b>. AgendaUrlOptions2=<b>login=%s</b> to restrict output to actions created by or assigned to user <b>%s</b>.
AgendaUrlOptions3=<b>logina=%s</b> to restrict output to actions owned by a user <b>%s</b>. AgendaUrlOptions3=<b>logina=%s</b> to restrict output to actions owned by a user <b>%s</b>.
AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to user <b>%s</b>. AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to user <b>%s</b>.
AgendaUrlOptionsProject=<b>project=PROJECT_ID</b> to restrict output to actions associated to project <b>PROJECT_ID</b>. AgendaUrlOptionsProject=<b>project=PROJECT_ID</b> to restrict output to actions associated to project <b>PROJECT_ID</b>.

View File

@ -91,6 +91,8 @@ ErrorModuleSetupNotComplete=Setup of module looks to be uncomplete. Go on Setup
ErrorBadMask=Error on mask ErrorBadMask=Error on mask
ErrorBadMaskFailedToLocatePosOfSequence=Error, mask without sequence number ErrorBadMaskFailedToLocatePosOfSequence=Error, mask without sequence number
ErrorBadMaskBadRazMonth=Error, bad reset value ErrorBadMaskBadRazMonth=Error, bad reset value
ErrorMaxNumberReachForThisMask=Max number reach for this mask
ErrorCounterMustHaveMoreThan3Digits=Counter must have more than 3 digits
ErrorSelectAtLeastOne=Error. Select at least one entry. ErrorSelectAtLeastOne=Error. Select at least one entry.
ErrorProductWithRefNotExist=Product with reference '<i>%s</i>' don't exist ErrorProductWithRefNotExist=Product with reference '<i>%s</i>' don't exist
ErrorDeleteNotPossibleLineIsConsolidated=Delete not possible because record is linked to a bank transation that is conciliated ErrorDeleteNotPossibleLineIsConsolidated=Delete not possible because record is linked to a bank transation that is conciliated

View File

@ -206,6 +206,7 @@ MigrationProjectTaskTime=Update time spent in seconds
MigrationActioncommElement=Update data on actions MigrationActioncommElement=Update data on actions
MigrationPaymentMode=Data migration for payment mode MigrationPaymentMode=Data migration for payment mode
MigrationCategorieAssociation=Migration of categories MigrationCategorieAssociation=Migration of categories
MigrationEvents=Migration of events to add event owner into assignement table
ShowNotAvailableOptions=Show not available options ShowNotAvailableOptions=Show not available options
HideNotAvailableOptions=Hide not available options HideNotAvailableOptions=Hide not available options

View File

@ -91,6 +91,8 @@ ErrorModuleSetupNotComplete=La configuration du module semble incomplète. Aller
ErrorBadMask=Erreur sur le masque ErrorBadMask=Erreur sur le masque
ErrorBadMaskFailedToLocatePosOfSequence=Erreur, masque sans numéro de séquence ErrorBadMaskFailedToLocatePosOfSequence=Erreur, masque sans numéro de séquence
ErrorBadMaskBadRazMonth=Erreur, mauvais valeur de remise à zéro ErrorBadMaskBadRazMonth=Erreur, mauvais valeur de remise à zéro
ErrorMaxNumberReachForThisMask=Valeur maximale atteinte pour ce masque
ErrorCounterMustHaveMoreThan3Digits=Le compteur doit avoir plus de 3 chiffres
ErrorSelectAtLeastOne=Erreur. Sélectionnez au moins une entrée. ErrorSelectAtLeastOne=Erreur. Sélectionnez au moins une entrée.
ErrorProductWithRefNotExist=La référence produit '<i>%s</i>' n'existe pas ErrorProductWithRefNotExist=La référence produit '<i>%s</i>' n'existe pas
ErrorDeleteNotPossibleLineIsConsolidated=Suppression impossible car l'enregistrement porte sur au moins une transaction bancaire rapprochée ErrorDeleteNotPossibleLineIsConsolidated=Suppression impossible car l'enregistrement porte sur au moins une transaction bancaire rapprochée

View File

@ -69,7 +69,6 @@ if (! empty($_GET["project"])) $filters['project']=$_GET["project"];
if (! empty($_GET["login"])) $filters['login']=$_GET["login"]; if (! empty($_GET["login"])) $filters['login']=$_GET["login"];
if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"]; if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"];
if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"]; if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"];
if (! empty($_GET["logind"])) $filters['logind']=$_GET["logind"];
// Not older than // Not older than
if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100;
$filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY;
@ -111,8 +110,7 @@ foreach ($filters as $key => $value)
if ($key == 'project') $filename.='-project'.$value; if ($key == 'project') $filename.='-project'.$value;
if ($key == 'login') $filename.='-login'.$value; if ($key == 'login') $filename.='-login'.$value;
if ($key == 'logina') $filename.='-logina'.$value; // Author if ($key == 'logina') $filename.='-logina'.$value; // Author
if ($key == 'logind') $filename.='-logind'.$value; // Affected to if ($key == 'logint') $filename.='-logint'.$value; // Assigned to
if ($key == 'logint') $filename.='-logint'.$value; // Done by
} }
// Add extension // Add extension
if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; } if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; }

View File

@ -4,11 +4,14 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require '../../main.inc.php'; require '../../main.inc.php';
if ($_SERVER['HTTP_HOST'] != 'localhost')
if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1')
{ {
print "Page available only with url http://localhost/..."; print "Page available only frome remote address 127.0.0.1";
exit; exit;
} }
$usedolheader=0; // 1 = Test inside a dolibarr page, 0 = Use hard coded header $usedolheader=0; // 1 = Test inside a dolibarr page, 0 = Use hard coded header

View File

@ -6,9 +6,9 @@ define('REQUIRE_JQUERY_MULTISELECT','select2');
require '../../main.inc.php'; require '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if ($_SERVER['HTTP_HOST'] != 'localhost') if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1')
{ {
print "Page available only with url http://localhost/..."; print "Page available only frome remote address 127.0.0.1";
exit; exit;
} }

View File

@ -59,9 +59,6 @@ $contactstatic = new Contact($db);
$form = new Form($db); $form = new Form($db);
/*
* Fiche categorie de client et/ou fournisseur
*/
if ($socid) if ($socid)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -70,79 +67,79 @@ if ($socid)
$langs->load("companies"); $langs->load("companies");
$soc = new Societe($db); $object = new Societe($db);
$result = $soc->fetch($socid); $result = $object->fetch($socid);
llxHeader("",$langs->trans("Agenda"),''); llxHeader("",$langs->trans("Agenda"),'');
if (! empty($conf->notification->enabled)) $langs->load("mails"); if (! empty($conf->notification->enabled)) $langs->load("mails");
$head = societe_prepare_head($soc); $head = societe_prepare_head($object);
dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"),0,'company');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom'); print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print '</td></tr>'; print '</td></tr>';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{ {
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>'; print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
} }
if ($soc->client) if ($object->client)
{ {
print '<tr><td>'; print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $soc->code_client; print $object->code_client;
if ($soc->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
print '</td></tr>'; print '</td></tr>';
} }
if ($soc->fournisseur) if ($object->fournisseur)
{ {
print '<tr><td>'; print '<tr><td>';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $soc->code_fournisseur; print $object->code_fournisseur;
if ($soc->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
print '</td></tr>'; print '</td></tr>';
} }
if (! empty($conf->barcode->enabled)) if (! empty($conf->barcode->enabled))
{ {
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->barcode.'</td></tr>'; print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$object->barcode.'</td></tr>';
} }
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">"; print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">";
dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id); dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
print "</td></tr>"; print "</td></tr>";
// Zip / Town // Zip / Town
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->zip."</td>"; print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$object->zip."</td>";
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$soc->town."</td></tr>"; print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$object->town."</td></tr>";
// Country // Country
if ($soc->country) { if ($object->country) {
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
$img=picto_from_langcode($soc->country_code); $img=picto_from_langcode($object->country_code);
print ($img?$img.' ':''); print ($img?$img.' ':'');
print $soc->country; print $object->country;
print '</td></tr>'; print '</td></tr>';
} }
// EMail // EMail
print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="3">';
print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL'); print dol_print_email($object->email,0,$object->id,'AC_EMAIL');
print '</td></tr>'; print '</td></tr>';
// Web // Web
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
print dol_print_url($soc->url); print dol_print_url($object->url);
print '</td></tr>'; print '</td></tr>';
// Phone / Fax // Phone / Fax
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').'</td>'; print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').'</td>';
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>'; print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';
print '</table>'; print '</table>';
@ -171,7 +168,7 @@ if ($socid)
print '<br>'; print '<br>';
$objthirdparty=$soc; $objthirdparty=$object;
$objcon=new stdClass(); $objcon=new stdClass();
$out=''; $out='';
@ -189,10 +186,10 @@ if ($socid)
print load_fiche_titre($langs->trans("ActionsOnCompany"),$out,''); print load_fiche_titre($langs->trans("ActionsOnCompany"),$out,'');
// List of todo actions // List of todo actions
show_actions_todo($conf,$langs,$db,$soc); show_actions_todo($conf,$langs,$db,$object);
// List of done actions // List of done actions
show_actions_done($conf,$langs,$db,$soc); show_actions_done($conf,$langs,$db,$object);
} }

View File

@ -59,21 +59,21 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url); llxHeader('',$langs->trans("ThirdParty"),$help_url);
$soc = new Societe($db); $object = new Societe($db);
$soc->fetch($socid); $object->fetch($socid);
$soc->info($socid); $object->info($socid);
/* /*
* Affichage onglets * Affichage onglets
*/ */
$head = societe_prepare_head($soc); $head = societe_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'info', $langs->trans("ThirdParty"),0,'company');
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($soc); dol_print_object_info($object);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -1751,7 +1751,8 @@ else
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'" class="nowrap">'; print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'" class="nowrap">';
if (! empty($object->country_code)) if (! empty($object->country_code))
{ {
$img=picto_from_langcode($object->country_code); //$img=picto_from_langcode($object->country_code);
$img='';
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->country; else print ($img?$img.' ':'').$object->country;
} }

View File

@ -0,0 +1,12 @@
Tutorial to create a new image for menu:
1) First find an image.
2) With Gimp, open image and check there is a alpha channel. If not add one.
3) Convert image into back and white.
4) Use the degrade tool with option:
* Erase color
* Opacity: 50 +/-
* Offset: 0
* Shape: Linear
Il est possible aussi d'augmenter la transparence globale depuis le calque.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -532,8 +532,8 @@ margin : 0px auto;
<?php <?php
$minwidthtmenu=66; $minwidthtmenu=66;
$heightmenu=52; $heightmenu=46; /* height of top menu, part with image */
$heightmenu2=40; $heightmenu2=46; /* height of top menu, ârt with login */
?> ?>
div#tmenu_tooltip { div#tmenu_tooltip {
@ -679,7 +679,7 @@ div.mainmenu {
position : relative; position : relative;
background-repeat:no-repeat; background-repeat:no-repeat;
background-position:center top; background-position:center top;
height: <?php echo ($heightmenu-17); ?>px; height: <?php echo ($heightmenu-19); ?>px;
margin-left: 0px; margin-left: 0px;
min-width: 40px; min-width: 40px;
} }
@ -704,16 +704,10 @@ div.mainmenu.bank {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/bank.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/bank.png',1) ?>);
} }
div.mainmenu.bookmark {
}
div.mainmenu.cashdesk { div.mainmenu.cashdesk {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/pointofsale.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/pointofsale.png',1) ?>);
} }
div.mainmenu.click2dial {
}
div.mainmenu.companies { div.mainmenu.companies {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png',1) ?>);
} }
@ -734,12 +728,6 @@ div.mainmenu.ftp {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>);
} }
div.mainmenu.gravatar {
}
div.mainmenu.geopipmaxmind {
}
div.mainmenu.hrm { div.mainmenu.hrm {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/holiday.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/holiday.png',1) ?>);
} }
@ -748,9 +736,6 @@ div.mainmenu.members {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png',1) ?>);
} }
div.mainmenu.paypal {
}
div.mainmenu.products { div.mainmenu.products {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png',1) ?>);
margin-left: 10px; margin-left: 10px;
@ -764,14 +749,6 @@ div.mainmenu.tools {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>);
} }
div.mainmenu.webservices {
}
div.mainmenu.google {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/globe.png',1) ?>);
}
<?php <?php
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div') // Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
@ -2443,6 +2420,11 @@ li.cal_event { border: none; list-style-type: none; }
.cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; }
.cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); } .cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); }
.cal_event_busy { } .cal_event_busy { }
.cal_peruserviewname { max-width: 100px; height: 22px; }
.topmenuimage {
background-size: 28px auto;
}
/* ============================================================================== */ /* ============================================================================== */
/* Ajax - Liste deroulante de l'autocompletion */ /* Ajax - Liste deroulante de l'autocompletion */

View File

@ -167,7 +167,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $result); // Can be deleted $this->assertEquals(1, $result); // Can be deleted
$result=$localobject->is_erasable(); $result=$localobject->is_erasable();
print __METHOD__." is_erasable=".$result."\n"; print __METHOD__." is_erasable=".$result."\n";
$this->assertEquals(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent $this->assertEquals(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent)
// Now we try with a reset // Now we try with a reset
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}'; $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}';
@ -543,6 +543,27 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals('198101-0001', $result); // counter must start to 1 $this->assertEquals('198101-0001', $result); // counter must start to 1
// Test with {t} tag
$conf->global->SOCIETE_FISCAL_MONTH_START=1;
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{t}{yyyy}{mm}-{0000}';
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{t}{yyyy}{mm}-{0000}';
$tmpthirdparty=new Societe($this->savdb);
$tmpthirdparty->initAsSpecimen();
$tmpthirdparty->typent_code = 'TE_ABC';
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1982 to be sure to not have existing invoice for this year
$numbering=new mod_facture_mercure();
$result=$numbering->getNextValue($tmpthirdparty, $localobject);
$result2=$localobject->create($user,1);
$result3=$localobject->validate($user, $result);
print __METHOD__." result=".$result."\n";
$this->assertEquals('A198201-0001', $result); // counter must start to 1
return $result; return $result;
} }