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

develop

Conflicts:
	htdocs/contrat/class/contrat.class.php
	htdocs/fourn/card.php
This commit is contained in:
Florian HENRY 2014-09-29 16:01:49 +02:00
commit 46f673fb5f
27 changed files with 579 additions and 488 deletions

View File

@ -6,12 +6,10 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
- New: PDF event report show project and status of event.
- New: Onto event summary of elements, end date and status are visible.
- New: Can filter on status on interventions.
- New: Add help info of field type into dictionary of payment types.
- New: Add proposals into referer page of thirdparty.
- New: On contact list can set filter on both active and not active (no more exclusive select).
- New: Each user can include its own external ics calendar into dolibarr agenda view.
- New: Intervention documents are now available in ECM module.
- New: Can attach supplier order to a customer order.
- New: Supervisor is now visible into user list.
@ -22,16 +20,21 @@ For users:
- New: No more dependency between contract and service module.
- New: [ task #867 ] Remove ESAEB external module code from core.
- New: Can create proposal from an intervention.
- New: An event can be assigned to several users.
- New: Can filter events on a group of users.
- New: Can filter events of a thirdparty.
- New: Onto event summary of elements, end date and status are visible.
- New: Split Agenda view (month, week, day) into different tabs.
- New: Add a view "per user" of agenda events (with different colors according to type of event).
- New: Each user can include its own external ics calendar into dolibarr agenda view.
- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to
create an automatic event into agenda.
- New: Add new type of event (when type of events are used, not by default).
- New: Can disable predefined type of events.
- New: Form to add a photo is immediatly available on photo page if
permissions are ok (save one click per photo to add).
- New: Add option PRODUCT_MAX_VISIBLE_PHOTO to limit number of photos
shown on main product card.
- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to
create an automatic event into agenda.
- New: Add new type of event (when type of events are used, not by default).
- New: Add country into table of thirdparties type. This will allow to provide
a list of thirdparty types specific to a country (like argentina that
need type A or B).

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
@ -375,7 +375,7 @@ $tabfieldcheck[24] = array();
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
// Define elementList and sourceList (used for dictionary "type of contacts")
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
$sourceList=array();
if ($id == 11)
@ -412,7 +412,7 @@ if ($id == 11)
);
}
// Define localtax_typeList (used for dictionary "c_tva")
// Define localtax_typeList (used for dictionary "llx_c_tva")
$localtax_typeList = array();
if ($id == 10)
{
@ -425,7 +425,6 @@ if ($id == 10)
"5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
"6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"),
);
if (! empty($conf->global->MAIN_USE_LOCALTAX_TYPE_7)) $localtax_typeList["7"]= $langs->trans("Yes").' ('.$langs->trans("Type")." 7)"; //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype
}
@ -445,6 +444,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ($value == 'color' && empty($_POST['color'])) continue;
if ((! isset($_POST[$value]) || $_POST[$value]=='')
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
)
@ -1127,27 +1127,29 @@ if ($id)
}
}
// Est-ce une entree du dictionnaire qui peut etre desactivee ?
// True by default
$iserasable=1;
// Can an entry be erased or disabled ?
$iserasable=1;$isdisable=1; // true by default
if (isset($obj->code))
{
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable = 0;
else if ($obj->code == 'RECEP') $iserasable = 0;
else if ($obj->code == 'EF0') $iserasable = 0;
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; }
else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; }
else if ($obj->code == 'EF0') { $iserasable = 0; $isdisable = 0; }
}
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0;
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $isdisable=0; $isdisable = 0; }
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?$obj->code:'').'&amp;id='.$id.'&amp;';
// Active
print '<td align="center" class="nowrap">';
if ($iserasable) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
if ($isdisable) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else
{
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
else print $langs->trans("AlwaysActive");
}
print "</td>";

View File

@ -171,28 +171,27 @@ if ($action == 'setModuleOptions')
$db->begin();
for($i=0;$i < $post_size;$i++)
{
if (array_key_exists('param'.$i,$_POST))
{
$param=GETPOST("param".$i,'alpha');
$value=GETPOST("value".$i,'alpha');
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
}
{
if (array_key_exists('param'.$i,$_POST))
{
$param=GETPOST("param".$i,'alpha');
$value=GETPOST("value".$i,'alpha');
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
}
if (! $error)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
}
}
// Activate a model
if ($action == 'set')
{

View File

@ -35,7 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
if (! empty($conf->projet->enabled)) {
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
@ -366,8 +367,8 @@ if ($action == 'update')
$object->location = GETPOST('location');
$object->socid = $_POST["socid"];
$object->contactid = $_POST["contactid"];
$object->societe->id = $_POST["socid"]; // deprecated
$object->contact->id = $_POST["contactid"]; // deprecated
//$object->societe->id = $_POST["socid"]; // deprecated
//$object->contact->id = $_POST["contactid"]; // deprecated
$object->fk_project = $_POST["projectid"];
$object->note = $_POST["note"];
$object->pnote = $_POST["note"];
@ -380,13 +381,14 @@ if ($action == 'update')
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")),$object->errors,'errors');
$action = 'edit';
}
$transparency=(GETPOST("transparency")=='on'?1:0);
// Users
$listofuserid=array();
//$assignedtouser=(GETPOST("assignedtouser") >0)?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : 0);
$assignedtouser=(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : 0);
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>$object->transparency); // Owner first
if (! empty($_SESSION['assignedtouser']))
$assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0);
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first
if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users
{
// Restore array with key with same value than param 'id'
$tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array();
@ -399,7 +401,7 @@ if ($action == 'update')
$object->userassigned=array(); // Clear old content
foreach($listofuserid as $key => $val)
{
$object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>(GETPOST("transparency")=='on'?1:0));
$object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>($user->id == $val['id'] ? $transparency : ''));
}
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
@ -670,36 +672,19 @@ if ($action == 'create')
$listofuserid=array();
if (empty($donotclearsession))
{
$assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id);
$assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first
$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
}
/*
if (empty($donotclearsession))
{
$assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id);
$_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('id'=>$assignedtouser,'transparency'=>1,'mandatory'=>1)));
}*/
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1);
//print $form->select_dolusers(GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
print '</td></tr>';
print '</table>';
print '<br><br>';
print '<table class="border" width="100%">';
// Busy
print '<tr><td width="30%" class="nowrap">'.$langs->trans("Busy").'</td><td>';
print '<input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked="checked"':'').'>';
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked="checked"':'').'> '.$langs->trans("Busy");
print '</td></tr>';
// Realised by
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
{
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td>';
print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1);
print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdoneid) && $percent==100?$object->userdoneid:0),'doneby',1);
print '</td></tr>';
}
@ -803,6 +788,7 @@ if ($id > 0)
{
$result1=$object->fetch($id);
$result2=$object->fetch_thirdparty();
$result2=$object->fetch_contact();
$result3=$object->fetch_userassigned();
$result4=$object->fetch_optionals($id,$extralabels);
@ -812,20 +798,15 @@ if ($id > 0)
exit;
}
if ($object->author->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->author->id); $object->author=$tmpuser; }
if ($object->usermod->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermod->id); $object->usermod=$tmpuser; }
if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; }
if ($object->userdone->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdone->id); $object->userdone=$tmpuser; }
if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; }
if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; }
if ($object->userownerid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userownerid); $object->usertodo=$tmpuser; }
if ($object->userdoneid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdoneid); $object->userdone=$tmpuser; }
$contact = new Contact($db);
if ($object->contact->id)
{
$result=$contact->fetch($object->contact->id,$user);
}
$object->contact = $contact;
/*
* Affichage onglets
* Show tabs
*/
$head=actions_prepare_head($object);
@ -867,7 +848,6 @@ if ($id > 0)
print '</script>'."\n";
}
// Fiche action en mode edition
print '<form name="formaction" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
@ -926,30 +906,33 @@ if ($id > 0)
$listofuserid=array();
if (empty($donotclearsession))
{
if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency); // Owner first
$listofuserid=array_merge($listofuserid,$object->userassigned);
if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->userassigned[$user->id]['transparency'],'answer_status'=>$object->userassigned[$user->id]['answer_status'],'mandatory'=>$object->userassigned[$user->id]['mandatory']); // Owner first
if (! empty($object->userassigned)) // Now concat assigned users
{
// Restore array with key with same value than param 'id'
$tmplist1=$object->userassigned; $tmplist2=array();
foreach($tmplist1 as $key => $val)
{
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
}
}
$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
}
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1);
//print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'assignedtouser',1);
print '</td></tr>';
print '</table><br><br><table class="border" width="100%">';
// Busy
print '<tr><td width="30%" class="nowrap">'.$langs->trans("Busy").'</td><td>';
print '<input id="transparency" type="checkbox" name="transparency"'.($object->transparency?' checked="checked"':'').'">';
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.($listofuserid[$user->id]['transparency']?' checked="checked"':'').'">'.$langs->trans("Busy");
print '</td></tr>';
// Realised by
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
{
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1);
print $form->select_dolusers($object->userdoneid> 0?$object->userdoneid:-1,'doneby',1);
print '</td></tr>';
}
print '</table><br><br>';
print '</table>';
print '<br><br>';
print '<table class="border" width="100%">';
@ -960,12 +943,12 @@ if ($id > 0)
print '<td>';
$events=array();
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
print $form->select_company($object->thirdparty->id,'socid','',1,1,0,$events);
print $form->select_company($object->socid,'socid','',1,1,0,$events);
print '</td>';
// Contact
print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
$form->select_contacts($object->thirdparty->id, $object->contact->id,'contactid',1);
$form->select_contacts($object->socid, $object->contactid,'contactid',1);
print '</td></tr>';
}
@ -979,10 +962,10 @@ if ($id > 0)
$langs->load("project");
print '<tr><td width="30%" valign="top">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=$formproject->select_projects($object->thirdparty->id,$object->fk_project,'projectid');
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid');
if ($numprojet==0)
{
print ' &nbsp; <a href="../../projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
print ' &nbsp; <a href="../../projet/card.php?socid='.$object->socid.'&action=create">'.$langs->trans("AddProject").'</a>';
}
print '</td></tr>';
}
@ -1056,99 +1039,65 @@ if ($id > 0)
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) $rowspan++;
// Date start
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="2">';
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour');
else print dol_print_date($object->datep,'day');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="180">'."\n";
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_month">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_week">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_day">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_peruser">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n";
print '</td>';
print '</tr>';
// Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="2">';
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour');
else print dol_print_date($object->datef,'day');
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
print '</td></tr>';
// Status
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="2">';
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
print $object->getLibStatut(4);
print '</td></tr>';
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
{
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="2">'.$object->location.'</td></tr>';
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3">'.$object->location.'</td></tr>';
}
// Assigned to
//if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1);
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
$listofuserid=array();
if (empty($donotclearsession))
{
if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency); // Owner first
$listofuserid=array_merge($listofuserid,$object->userassigned);
if (is_object($object->usertodo)) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
if (! empty($object->userassigned)) // Now concat assigned users
{
// Restore array with key with same value than param 'id'
$tmplist1=$object->userassigned; $tmplist2=array();
foreach($tmplist1 as $key => $val)
{
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
}
}
$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
//var_dump($_SESSION['assignedtouser']);
}
print $form->select_dolusers_forevent('view','assignedtouser',1);
print '</td></tr>';
print '</table><br><br><table class="border" width="100%">';
// Busy
print '<tr><td width="30%" class="nowrap">'.$langs->trans("Busy").'</td><td colspan="3">';
if ($object->usertodo->id > 0) print yn(($object->transparency > 0)?1:0); // We show nothing if event is assigned to nobody
print '</td></tr>';
print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
print ' </td></tr>';
// Done by
if ($conf->global->AGENDA_ENABLE_DONEBY)
{
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
if ($object->userdone->id > 0) print $object->userdone->getNomUrl(1);
if ($object->userdoneid > 0) print $object->userdone->getNomUrl(1);
print '</td></tr>';
}
print '</table><br><br><table class="border" width="100%">';
print '</table>';
print '<br><br>';
print '<table class="border" width="100%">';
// Third party - Contact
if ($conf->societe->enabled)
@ -1164,12 +1113,12 @@ if ($id > 0)
print '</td>';
print '<td>'.$langs->trans("Contact").'</td>';
print '<td>';
if ($object->contact->id > 0)
if ($object->contactid > 0)
{
print $object->contact->getNomUrl(1);
if ($object->contact->id && $object->type_code == 'AC_TEL')
if ($object->contactid && $object->type_code == 'AC_TEL')
{
if ($object->contact->fetch($object->contact->id))
if ($object->contact->fetch($object->contactid))
{
print "<br>".dol_print_phone($object->contact->phone_pro);
}
@ -1250,7 +1199,7 @@ if ($id > 0)
if ($action != 'edit')
{
if ($user->rights->agenda->allactions->create ||
(($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->create))
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=edit&id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
}
@ -1260,7 +1209,7 @@ if ($id > 0)
}
if ($user->rights->agenda->allactions->delete ||
(($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete))
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete))
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?action=delete&id='.$object->id.'">'.$langs->trans("Delete").'</a></div>';
}
@ -1272,6 +1221,47 @@ if ($id > 0)
}
print '</div>';
// Link to agenda views
print '<div id="agendaviewbutton">';
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_month">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_week">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_day">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_peruser">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n";
print '</div>';
}

View File

@ -39,9 +39,10 @@ class ActionComm extends CommonObject
var $id;
var $type_id; // id into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required). With defautl setup, should be AC_OTH_AUTO or AC_OTH
var $type; // label into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
var $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set)
var $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
var $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set)
var $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set)
var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
var $label;
@ -56,7 +57,7 @@ class ActionComm extends CommonObject
var $datef; // Date action end (datep2)
var $durationp = -1; // -1=Unkown duration // deprecated
var $fulldayevent = 0; // 1=Event on full day
var $punctual = 1; // Milestone
var $punctual = 1; // Milestone // TODO Not sure we need this. Milestone is already event with end date = start date
var $percentage; // Percentage
var $location; // Location
@ -66,7 +67,8 @@ class ActionComm extends CommonObject
var $userassigned = array(); // Array of user ids
var $userownerid; // Id of user owner
var $usertodo; // Object user of owner // deprecated
var $userdoneid; // Id of user done
var $usertodo; // Object user of owner // deprecated
var $userdone; // Object user that did action // deprecated
var $socid;
@ -352,25 +354,29 @@ class ActionComm extends CommonObject
$this->note = $obj->note;
$this->percentage = $obj->percentage;
$this->author->id = $obj->fk_user_author;
$this->author->firstname = $obj->firstname;
$this->author->lastname = $obj->lastname;
$this->usermod->id = $obj->fk_user_mod;
$this->authorid = $obj->fk_user_author;
$this->usermodid = $obj->fk_user_mod;
$this->author->id = $obj->fk_user_author; // deprecated
$this->author->firstname = $obj->firstname; // deprecated
$this->author->lastname = $obj->lastname; // deprecated
$this->usermod->id = $obj->fk_user_mod; // deprecated
$this->userownerid = $obj->fk_user_action;
$this->userdoneid = $obj->fk_user_done;
$this->usertodo->id = $obj->fk_user_action; // deprecated
//$this->userdone->id = $obj->fk_user_done;
$this->userdone->id = $obj->fk_user_done; // deprecated
$this->priority = $obj->priority;
$this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location;
$this->transparency = $obj->transparency;
$this->punctual = $obj->punctual;
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->contactid = $obj->fk_contact;
$this->contactid = $obj->fk_contact; // To have fetch_contact method working
$this->fk_project = $obj->fk_project; // To have fetch_project method working
$this->societe->id = $obj->fk_soc; // For backward compatibility
$this->contact->id = $obj->fk_contact; // For backward compatibility
$this->societe->id = $obj->fk_soc; // deprecated
$this->contact->id = $obj->fk_contact; // deprecated
$this->fk_element = $obj->fk_element;
$this->elementtype = $obj->elementtype;
@ -1041,6 +1047,7 @@ class ActionComm extends CommonObject
$event['fulldayevent']=$obj->fulldayevent;
$event['location']=$obj->location;
$event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy)
$event['punctual']=$obj->punctual;
$event['category']=$obj->libelle; // libelle type action
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
@ -1146,7 +1153,7 @@ class ActionComm extends CommonObject
$this->punctual=0;
$this->percentage=0;
$this->location='Location';
$this->transparency=0;
$this->transparency=1; // 1 means opaque
$this->priority=1;
$this->note = 'Note';
}

View File

@ -1140,7 +1140,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
// Define $color and $cssclass of event
// Define $color (Hex string like '0088FF') and $cssclass of event
$color=-1; $cssclass=''; $colorindex=-1;
if (in_array($user->id, $keysofuserassigned))
{
@ -1163,8 +1163,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$color=$event->icalcolor;
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
}
else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); }
else { $numother++; $cssclass='family_other'; }
else if ($event->type_code == 'BIRTHDAY')
{
$numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
}
else
{
$numother++; $cssclass='family_other';
}
if ($color == -1) // Color was not forced. Set color according to color index.
{
// Define color index if not yet defined

View File

@ -108,7 +108,7 @@ $begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tm
$end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5);
if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
if ($end_d < 1 || $end_d > 7) $end_d = 7;
if ($end_d <= $begin_d) $end_d = $begin_d + 1;
if ($end_d < $begin_d) $end_d = $begin_d + 1;
if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
@ -321,7 +321,7 @@ $sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact,';
$sql.= ' ca.code';
$sql.= ' ca.code, ca.color';
$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 ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
@ -396,6 +396,7 @@ if ($resql)
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
$event->datef=$db->jdate($obj->datep2);
$event->type_code=$obj->code;
$event->type_color=$obj->color;
//$event->libelle=$obj->label; // deprecated
$event->label=$obj->label;
$event->percentage=$obj->percent;
@ -665,7 +666,7 @@ jQuery(document).ready(function() {
else if (ids.indexOf(",") > -1) /* There is several events */
{
/* alert(\'several events\'); */
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+dateselectday;
window.location.href = url;
}
else /* One event */
@ -744,12 +745,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
// Define $color and $cssclass of event
// Define $color (Hex string like '0088FF') and $cssclass of event
$color=-1; $cssclass=''; $colorindex=-1;
if (in_array($user->id, $keysofuserassigned))
{
$nummytasks++; $cssclass='family_mytasks';
// TODO Set color according to event type
$color=$event->type_color;
}
else if ($event->type_code == 'ICALEVENT')
{
@ -760,15 +761,19 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
$numicals[dol_string_nospecial($event->icalname)]++;
}
$color=$event->icalcolor;
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
}
else if ($event->type_code == 'BIRTHDAY') {
else if ($event->type_code == 'BIRTHDAY')
{
$numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
}
else { $numother++; $cssclass='family_other';
else
{
$numother++; $cssclass='family_other';
}
if ($color == -1) // Color was not forced. Set color according to color index.
if ($color < 0) // Color was not forced. Set color according to color index.
{
// Define color index if not yet defined
$idusertouse=($event->userownerid?$event->userownerid:0);
@ -791,7 +796,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
for ($h = $begin_h; $h < $end_h; $h++)
{
//if ($username->id == 1 && $day==1) print 'h='.$h;
$color = ''; //init
$newcolor = ''; //init
if (empty($event->fulldayevent))
{
$a = dol_mktime((int) $h,0,0,$month,$day,$year,false,false);
@ -801,6 +806,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$dateendtouse=$event->date_end_in_calendar;
if ($dateendtouse==$event->date_start_in_calendar) $dateendtouse++;
//print dol_print_date($event->date_start_in_calendar,'dayhour').'-'.dol_print_date($a,'dayhour').'-'.dol_print_date($b,'dayhour').'<br>';
if ($event->date_start_in_calendar < $b && $dateendtouse > $a)
{
$busy=$event->transparency;
@ -817,8 +824,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$cases1[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
$cases1[$h][$event->id]['string'].='xxx';
//$cases1[$h][$event->id]['string'].='xxx';
}
$cases1[$h][$event->id]['color']=$color;
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
{
@ -836,8 +844,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$cases2[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
$cases2[$h][$event->id]['string'].='xxx';
//$cases2[$h][$event->id]['string'].='xxx';
}
$cases2[$h][$event->id]['color']=$color;
}
}
else
@ -849,7 +858,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$cases2[$h][$event->id]['string']=$event->label;
$cases1[$h][$event->id]['typecode']=$event->type_code;
$cases2[$h][$event->id]['typecode']=$event->type_code;
//break;
$cases1[$h][$event->id]['color']='009900';
$cases2[$h][$event->id]['color']='009900';
}
}
$i++;
@ -861,6 +871,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
for ($h = $begin_h; $h < $end_h; $h++)
{
$color1='';$color2='';
$style1='';$style2='';
$string1='&nbsp;';$string2='&nbsp;';
$title1='';$title2='';
@ -893,20 +904,25 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$ids=array_keys($cases1[$h]);
$output = array_slice($cases1[$h], 0, 1);
if ($output[0]['string']) $title1.=' - '.$output[0]['string'];
if ($output[0]['color']) $color1 = $output[0]['color'];
}
else if (count($cases1[$h]) > 1) $color1='222222';
if (count($cases2[$h]) == 1) // 1 seul evenement
{
$ids=array_keys($cases2[$h]);
$output = array_slice($cases2[$h], 0, 1);
if ($output[0]['string']) $title2.=' - '.$output[0]['string'];
if ($output[0]['color']) $color2 = $output[0]['color'];
}
else if (count($cases2[$h]) > 1) $color2='222222';
$ids1=join(',',array_keys($cases1[$h]));
$ids2=join(',',array_keys($cases2[$h]));
//var_dump($cases1[$h]);
print '<table class="nobordernopadding" width="100%">';
print '<tr><td class="'.($style1?$style1.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_00_'.($ids1?$ids1:'none').'"'.($title1?' title="'.$title1.'"':'').'>';
print '<tr><td '.($color1?'style="background: #'.$color1.';"':'').'class="'.($style1?$style1.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_00_'.($ids1?$ids1:'none').'"'.($title1?' title="'.$title1.'"':'').'>';
print $string1;
print '</td><td class="'.($style2?$style2.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_30_'.($ids2?$ids2:'none').'"'.($title2?' title="'.$title2.'"':'').'>';
print '</td><td '.($color2?'style="background: #'.$color2.';"':'').'class="'.($style2?$style2.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_30_'.($ids2?$ids2:'none').'"'.($title2?' title="'.$title2.'"':'').'>';
print $string2;
print '</td></tr>';
print '</table>';

View File

@ -156,8 +156,9 @@ if ($viewstatut <> '')
}
if ($viewstatut == -3) // To bill
{
$sql.= ' AND c.fk_statut in (1,2,3)';
$sql.= ' AND c.facture = 0'; // invoice not created
//$sql.= ' AND c.fk_statut in (1,2,3)';
//$sql.= ' AND c.facture = 0'; // invoice not created
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
}
}
if ($ordermonth > 0)

View File

@ -866,6 +866,16 @@ else if ($action == 'add' && $user->rights->facture->creer)
// Possibility to add external linked objects with hooks
$object->linked_objects [$object->origin] = $object->origin_id;
// link with order if it is a shipping invoice
if ($object->origin == 'shipping')
{
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
$exp = new Expedition($db);
$exp->fetch($object->origin_id);
$exp->fetchObjectLinked();
if (count ($exp->linkedObjectsIds['commande']) > 0) $object->linked_objects['commande'] = $exp->linkedObjectsIds['commande'][0];
}
if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) {
$object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
@ -65,6 +65,7 @@ class Contrat extends CommonObject
var $note; // deprecated
var $note_private;
var $note_public;
var $modelpdf;
var $fk_projet;
@ -401,7 +402,7 @@ class Contrat extends CommonObject
$sql.= " fk_user_author,";
$sql.= " fk_projet,";
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
$sql.= " note_private, note_public, extraparams";
$sql.= " note_private, note_public, model_pdf, extraparams";
$sql.= " ,ref_supplier";
$sql.= " ,ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
@ -436,6 +437,7 @@ class Contrat extends CommonObject
$this->note = $result["note_private"]; // deprecated
$this->note_private = $result["note_private"];
$this->note_public = $result["note_public"];
$this->modelpdf = $result["model_pdf"];
$this->fk_projet = $result["fk_projet"]; // deprecated
$this->fk_project = $result["fk_projet"];

View File

@ -577,11 +577,15 @@ abstract class CommonObject
/**
* Charge le contact d'id $id dans this->contact
*
* @param int $contactid Id du contact
* @param int $contactid Id du contact. Use this->contactid if empty.
* @return int <0 if KO, >0 if OK
*/
function fetch_contact($contactid)
function fetch_contact($contactid='')
{
if (empty($contactid)) $contactid=$this->contactid;
if (empty($contactid)) return 0;
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$contact = new Contact($this->db);
$result=$contact->fetch($contactid);

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -152,10 +152,12 @@ class HookManager
$modulealreadyexecuted=array();
$resaction=0; $error=0; $result='';
$this->resPrint=''; $this->resArray=array();
foreach($this->hooks as $modules) // this->hooks is an array with context as key and value is an array of modules that handle this context
foreach($this->hooks as $context => $modules) // this->hooks is an array with context as key and value is an array of modules that handle this context
{
if (! empty($modules))
{
$modulealreadyexecuted[$context]=array(); // Filter by context
foreach($modules as $module => $actionclassinstance)
{
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n";
@ -164,8 +166,10 @@ class HookManager
// jump to next class if method does not exists
if (! method_exists($actionclassinstance,$method)) continue;
// test to avoid to run twice a hook, when a module implements several active contexts
if (in_array($module,$modulealreadyexecuted)) continue;
$modulealreadyexecuted[$module]=$module;
if (in_array($module,$modulealreadyexecuted[$context])) continue;
$modulealreadyexecuted[$context][$module]=$module; // Use the $currentcontext in method for avoid to run twice
// Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
$parameters['currentcontext'] = $context;
// Hooks that must return int (hooks with type 'addreplace')
if ($hooktype == 'addreplace')
{

View File

@ -1329,9 +1329,9 @@ class Form
{
$assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
}
$numassignetouser=count($assignedtouser);
$nbassignetouser=count($assignedtouser);
if ($numassignetouser && $action != 'view') $out.='<br>';
if ($nbassignetouser && $action != 'view') $out.='<br>';
$i=0; $ownerid=0;
foreach($assignedtouser as $key => $value)
{
@ -1339,7 +1339,7 @@ class Form
$userstatic->fetch($value['id']);
$out.=$userstatic->getNomUrl(1);
if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; }
if ($numassignetouser > 1 && $action != 'view') $out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
if ($nbassignetouser > 1 && $action != 'view') $out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
//$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional"));
//$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy"));
$out.='<br>';

View File

@ -19,7 +19,7 @@
*/
/**
* \file htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php
* \file htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
* \ingroup project
* \brief File of class to build ODT documents for third parties
*/

View File

@ -17,7 +17,7 @@
*/
/**
* \file htdocs/core/modules/project/pdf/pdf_baleine.modules.php
* \file htdocs/core/modules/project/doc/pdf_baleine.modules.php
* \ingroup project
* \brief Fichier de la classe permettant de generer les projets au modele Baleine
* \author Regis Houssin

View File

@ -1,28 +1,28 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php
* \file htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
* \ingroup project
* \brief File of class to build ODT documents for third parties
*/
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/task/modules_task.php';
@ -304,7 +304,7 @@ class doc_generic_task_odt extends ModelePDFTask
$texte = $this->description.".<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="setModuleOptionsTask">';
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
$texte.= '<input type="hidden" name="param1" value="PROJECT_TASK_ADDON_PDF_ODT_PATH">';
$texte.= '<table class="nobordernopadding" width="100%">';
@ -367,7 +367,7 @@ class doc_generic_task_odt extends ModelePDFTask
*/
function write_file($object,$outputlangs,$srctemplatepath)
{
global $user,$langs,$conf,$mysoc;
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{
@ -819,8 +819,8 @@ class doc_generic_task_odt extends ModelePDFTask
// Call the beforeODTSave hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
// Write new file
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
try {
@ -838,9 +838,9 @@ class doc_generic_task_odt extends ModelePDFTask
return -1;
}
}
$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Jean Heimburger <jean@tiaris.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -48,13 +49,13 @@ $result = restrictedArea($user, 'societe&fournisseur', $id, '&societe');
$object = new Fournisseur($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('suppliercard'));
/*
* Action
*/
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('suppliercard'));
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -451,12 +452,14 @@ if ($object->fetch($id))
/*
* Barre d'actions
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook))
{
print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
if ($user->rights->fournisseur->commande->creer)
{
$langs->load("orders");
@ -515,6 +518,7 @@ if ($object->fetch($id))
show_actions_done($conf,$langs,$db,$object);
}
}
}
else
{
dol_print_error($db);

View File

@ -1821,98 +1821,104 @@ elseif (! empty($object->id))
/**
* Boutons actions
*/
if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete')
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook))
{
print '<div class="tabsAction">';
// Validate
if ($object->statut == 0 && $num > 0)
if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete')
{
if ($user->rights->fournisseur->commande->valider)
print '<div class="tabsAction">';
// Validate
if ($object->statut == 0 && $num > 0)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid"';
print '>'.$langs->trans('Validate').'</a>';
if ($user->rights->fournisseur->commande->valider)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid"';
print '>'.$langs->trans('Validate').'</a>';
}
}
}
// Modify
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->commander)
// Modify
if ($object->statut == 1)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Modify").'</a>';
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Modify").'</a>';
}
}
}
// Approve
if ($object->statut == 1)
{
if ($user->rights->fournisseur->commande->approuver)
// Approve
if ($object->statut == 1)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=approve">'.$langs->trans("ApproveOrder").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
if ($user->rights->fournisseur->commande->approuver)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=approve">'.$langs->trans("ApproveOrder").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("ApproveOrder").'</a>';
print '<a class="butActionRefused" href="#">'.$langs->trans("RefuseOrder").'</a>';
}
}
else
// Send
if (in_array($object->statut, array(2, 3, 4, 5)))
{
print '<a class="butActionRefused" href="#">'.$langs->trans("ApproveOrder").'</a>';
print '<a class="butActionRefused" href="#">'.$langs->trans("RefuseOrder").'</a>';
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>';
}
}
}
// Send
if (in_array($object->statut, array(2, 3, 4, 5)))
{
if ($user->rights->fournisseur->commande->commander)
// Reopen
if (in_array($object->statut, array(2, 5, 6, 7, 9)))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>';
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a>';
}
}
}
// Reopen
if (in_array($object->statut, array(2, 5, 6, 7, 9)))
{
if ($user->rights->fournisseur->commande->commander)
// Create bill
if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a>';
if ($user->rights->fournisseur->facture->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
}
//if ($user->rights->fournisseur->commande->creer && $object->statut > 2)
//{
// print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
//}
}
}
// Create bill
if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted
{
if ($user->rights->fournisseur->facture->creer)
// Cancel
if ($object->statut == 2)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
}
}
//if ($user->rights->fournisseur->commande->creer && $object->statut > 2)
//{
// print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
//}
}
// Cancel
if ($object->statut == 2)
{
if ($user->rights->fournisseur->commande->commander)
// Clone
if ($user->rights->fournisseur->commande->creer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a>';
}
// Delete
if ($user->rights->fournisseur->commande->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
print "</div>";
}
// Clone
if ($user->rights->fournisseur->commande->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a>';
}
// Delete
if ($user->rights->fournisseur->commande->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
print "</div>";
}
print "<br>";

View File

@ -219,6 +219,7 @@ AutomaticIfJavascriptDisabled=Automatic if Javascript is disabled
AvailableOnlyIfJavascriptNotDisabled=Available only if JavaScript is not disabled
AvailableOnlyIfJavascriptAndAjaxNotDisabled=Available only if JavaScript is not disabled
Required=Required
UsedOnlyWithTypeOption=Used by some agenda option only
Security=Security
Passwords=Passwords
DoNotStoreClearPassword=Do no store clear passwords in database but store only encrypted value (Activated recommended)

View File

@ -88,4 +88,5 @@ ExtSiteUrlAgenda=URL to access .ical file
ExtSiteNoLabel=No Description
WorkingTimeRange=Working time range
WorkingDaysRange=Working days range
AddEvent=Create event
AddEvent=Create event
MyAvailability=Ma disponibilité

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
/* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -99,7 +99,7 @@ else if ($action == 'specimen')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/project/pdf/pdf_".$modele.".modules.php",0);
$file=dol_buildpath($reldir."core/modules/project/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
@ -144,7 +144,7 @@ else if ($action == 'specimentask')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/project/task/pdf/pdf_".$modele.".modules.php",0);
$file=dol_buildpath($reldir."core/modules/project/task/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
@ -177,6 +177,35 @@ else if ($action == 'specimentask')
}
}
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
if ($action == 'setModuleOptions')
{
$post_size=count($_POST);
$db->begin();
for($i=0;$i < $post_size;$i++)
{
if (array_key_exists('param'.$i,$_POST))
{
$param=GETPOST("param".$i,'alpha');
$value=GETPOST("value".$i,'alpha');
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
}
if (! $error)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
}
}
// Activate a model
else if ($action == 'set')
{
@ -256,26 +285,10 @@ else if ($action == 'setmodtask')
dolibarr_set_const($db, "PROJECT_TASK_ADDON",$value,'chaine',0,'',$conf->entity);
}
else if ($action=='setModuleOptions') {
if (dolibarr_set_const($db, "PROJECT_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->PROJECT_ADDON_PDF_ODT_PATH = GETPOST('value1');
}
}
else if ($action=='setModuleOptionsTask') {
if (dolibarr_set_const($db, "PROJECT_TASK_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH = GETPOST('value1');
}
}
/*
* View
*/
*/
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
@ -542,99 +555,108 @@ clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/project/pdf/");
if (is_dir($dir))
foreach (array('','/doc') as $valdir)
{
$handle=opendir($dir);
if (is_resource($handle))
$dir = dol_buildpath($reldir."core/modules/project/".$valdir);
if (is_dir($dir))
{
while (($file = readdir($handle))!==false)
$handle=opendir($dir);
if (is_resource($handle))
{
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
while (($file = readdir($handle))!==false)
{
if (file_exists($dir.'/'.$file))
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
if (file_exists($dir.'/'.$file))
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs);
else print $module->description;
print "</td>\n";
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
require_once $dir.'/'.$file;
$module = new $classname($db);
// Default
print "<td align=\"center\">";
if ($conf->global->PROJECT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
if ($modulequalified)
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs);
else print $module->description;
print "</td>\n";
// Preview
print '<td align="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"),'generic');
}
print '</td>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
print "</tr>\n";
}
// Default
print "<td align=\"center\">";
if ($conf->global->PROJECT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
// Preview
print '<td align="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"),'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
closedir($handle);
}
}
}
@ -688,98 +710,107 @@ clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/project/task/pdf/");
if (is_dir($dir))
foreach (array('','/doc') as $valdir)
{
$handle=opendir($dir);
if (is_resource($handle))
$dir = dol_buildpath($reldir."core/modules/project/task/".$valdir);
if (is_dir($dir))
{
while (($file = readdir($handle))!==false)
$handle=opendir($dir);
if (is_resource($handle))
{
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
while (($file = readdir($handle))!==false)
{
if (file_exists($dir.'/'.$file))
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
if (file_exists($dir.'/'.$file))
{
$var = !$var;
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs);
else print $module->description;
print "</td>\n";
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deltask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=settask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
require_once $dir.'/'.$file;
$module = new $classname($db);
// Defaut
print "<td align=\"center\">";
if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoctask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
if ($modulequalified)
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
$var = !$var;
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs);
else print $module->description;
print "</td>\n";
// Preview
print '<td align="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimentask&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deltask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=settask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoctask&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
// Preview
print '<td align="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimentask&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"),'generic');
}
print '</td>';
print "</tr>\n";
}
else
{
print img_object($langs->trans("PreviewNotAvailable"),'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
closedir($handle);
}
}
}

View File

@ -1368,7 +1368,7 @@ class Project extends CommonObject
}
}
$modelpath = "core/modules/project/pdf/";
$modelpath = "core/modules/project/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}

View File

@ -1343,7 +1343,7 @@ class Task extends CommonObject
}
}
$modelpath = "core/modules/project/task/pdf/";
$modelpath = "core/modules/project/task/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}

View File

@ -136,7 +136,9 @@ $server->wsdl->addComplexType(
'minOccurs' => '0',
'maxOccurs' => 'unbounded'
)
)
),
null,
'tns:line'
);
@ -197,7 +199,9 @@ $server->wsdl->addComplexType(
'minOccurs' => '0',
'maxOccurs' => 'unbounded'
)
)
),
null,
'tns:invoice'
);

View File

@ -42,7 +42,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/pdf.lib.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/propale/doc/pdf_azur.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/project/pdf/pdf_baleine.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/project/doc/pdf_baleine.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_rouget.modules.php';