diff --git a/htdocs/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php
similarity index 92%
rename from htdocs/admin/fiscalyear.php
rename to htdocs/accountancy/admin/fiscalyear.php
index dfb404b0b6b..5907c754644 100644
--- a/htdocs/admin/fiscalyear.php
+++ b/htdocs/accountancy/admin/fiscalyear.php
@@ -16,12 +16,12 @@
*/
/**
- * \file htdocs/admin/fiscalyear.php
+ * \file htdocs/accountancy/admin/fiscalyear.php
* \ingroup fiscal year
* \brief Setup page to configure fiscal year
*/
-require '../main.inc.php';
+require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
@@ -55,6 +55,8 @@ $object = new Fiscalyear($db);
* View
*/
+$max=100;
+
$form = new Form($db);
llxHeader('',$title);
@@ -68,16 +70,13 @@ $sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f";
$sql.= " WHERE f.entity = ".$conf->entity;
$result = $db->query($sql);
-
-$max=10;
-
if ($result)
{
$var=false;
$num = $db->num_rows($result);
$i = 0;
-
+
// Load attribute_label
print '
';
print '';
@@ -85,13 +84,13 @@ if ($result)
print ''.$langs->trans("Label").' ';
print ''.$langs->trans("DateStart").' ';
print ''.$langs->trans("DateEnd").' ';
- print ''.$langs->trans("Statut").' ';
+ print ''.$langs->trans("Statut").' ';
print ' ';
-
+
if ($num)
{
$fiscalyearstatic=new Fiscalyear($db);
-
+
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($result);
@@ -102,7 +101,7 @@ if ($result)
print ''.$obj->label.' ';
print ''.dol_print_date($db->jdate($obj->date_start),'day').' ';
print ''.dol_print_date($db->jdate($obj->date_end),'day').' ';
- print ''.$fiscalyearstatic->LibStatut($obj->statut,5).' ';
+ print ''.$fiscalyearstatic->LibStatut($obj->statut,5).' ';
print '';
$var=!$var;
$i++;
@@ -113,10 +112,9 @@ if ($result)
{
print ''.$langs->trans("None").' ';
}
-
+
print '
';
- print '';
-}
+}
else
{
dol_print_error($db);
diff --git a/htdocs/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php
similarity index 93%
rename from htdocs/admin/fiscalyear_card.php
rename to htdocs/accountancy/admin/fiscalyear_card.php
index b30cf2a69fc..423ac88b490 100644
--- a/htdocs/admin/fiscalyear_card.php
+++ b/htdocs/accountancy/admin/fiscalyear_card.php
@@ -16,11 +16,11 @@
*/
/**
- * \file htdocs/admin/fiscalyear_card.php
+ * \file htdocs/accountancy/admin/fiscalyear_card.php
* \brief Page to show a fiscal year
*/
-require '../main.inc.php';
+require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
@@ -51,6 +51,7 @@ $object = new Fiscalyear($db);
$date_start=dol_mktime(0,0,0,GETPOST('fiscalyearmonth','int'),GETPOST('fiscalyearday','int'),GETPOST('fiscalyearyear','int'));
$date_end=dol_mktime(0,0,0,GETPOST('fiscalyearendmonth','int'),GETPOST('fiscalyearendday','int'),GETPOST('fiscalyearendyear','int'));
+
/*
* Actions
*/
@@ -74,9 +75,7 @@ else if ($action == 'add')
if (! GETPOST('cancel','alpha'))
{
$error=0;
-
- $db->begin();
-
+
$object->date_start = $date_start;
$object->date_end = $date_end;
$object->label = GETPOST('label','alpha');
@@ -96,21 +95,27 @@ else if ($action == 'add')
if (! $error)
{
- $id = $object->create($user);
+ $db->begin();
+
+ $id = $object->create($user);
if ($id > 0)
{
+ $db->commit();
+
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
}
else
- {
- setEventMessage($object->error, 'errors');
+ {
+ $db->rollback();
+
+ setEventMessage($object->error, 'errors');
$action='create';
}
}
else
- {
+ {
$action='create';
}
}
@@ -127,7 +132,7 @@ else if ($action == 'update')
if (! GETPOST('cancel','alpha'))
{
$result = $object->fetch($id);
-
+
$object->date_start = empty($_POST["fiscalyear"])?'':$date_start;
$object->date_end = empty($_POST["fiscalyearend"])?'':$date_end;
$object->label = GETPOST('label','alpha');
@@ -175,7 +180,7 @@ if ($action == 'create')
// Label
print ''.$langs->trans("Label").' ';
-
+
// Date start
print ''.$langs->trans("DateStart").' ';
print $form->select_date(($date_start?$date_start:''),'fiscalyear');
@@ -185,7 +190,7 @@ if ($action == 'create')
print ' '.$langs->trans("DateEnd").' ';
print $form->select_date(($date_end?$date_end:-1),'fiscalyearend');
print ' ';
-
+
// Statut
print '';
print ''.$langs->trans("Statut").' ';
@@ -207,11 +212,11 @@ else if ($id)
{
$head = fiscalyear_prepare_head($object);
- dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
-
if ($action == 'edit')
{
- print ' ';
-
+
// Label
print ''.$langs->trans("Label").' ';
print ' ';
print ' ';
-
+
// Date start
print ''.$langs->trans("DateStart").' ';
print $form->select_date($object->date_start?$object->date_start:-1,'fiscalyear');
@@ -238,7 +243,7 @@ else if ($id)
print ' '.$langs->trans("DateEnd").' ';
print $form->select_date($object->date_end?$object->date_end:-1,'fiscalyearend');
print ' ';
-
+
// Statut
print ''.$langs->trans("Statut").' ';
print $form->selectarray('statut',$statut2label,$object->statut);
@@ -252,7 +257,7 @@ else if ($id)
print '';
- print '';
+ dol_fiche_end();
}
else
{
@@ -264,18 +269,20 @@ else if ($id)
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteFiscalYear"),$langs->trans("ConfirmDeleteFiscalYear"),"confirm_delete");
}
-
- print '';
+
+ dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
+
+ print '';
$linkback = ''.$langs->trans("BackToList").' ';
-
+
// Ref
print ''.$langs->trans("Ref").' ';
print $object->ref;
print ' ';
print $linkback;
print ' ';
-
+
// Label
print '';
print $form->editfieldkey("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32');
@@ -289,7 +296,7 @@ else if ($id)
print ' ';
print $form->editfieldval("Date",'date_start',$object->date_start,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
print ' ';
-
+
// Date end
print '';
print $form->editfieldkey("Date",'date_end',$object->date_end,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
@@ -300,9 +307,9 @@ else if ($id)
// Statut
print ' '.$langs->trans("Status").' '.$object->getLibStatut(4).' ';
- print "
";
+ print "
";
- print '';
+ dol_fiche_end();
/*
* Barre d'actions
@@ -311,9 +318,9 @@ else if ($id)
print '';
}
}
diff --git a/htdocs/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php
similarity index 94%
rename from htdocs/admin/fiscalyear_info.php
rename to htdocs/accountancy/admin/fiscalyear_info.php
index c59d75c8376..b6fa546edff 100644
--- a/htdocs/admin/fiscalyear_info.php
+++ b/htdocs/accountancy/admin/fiscalyear_info.php
@@ -16,11 +16,11 @@
*/
/**
- * \file htdocs/admin/fiscalyear_card.php
+ * \file htdocs/accountancy/admin/fiscalyear_card.php
* \brief Page to show info of a fiscal year
*/
-require '../main.inc.php';
+require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@@ -43,15 +43,15 @@ if ($id)
$object = new Fiscalyear($db);
$object->fetch($id);
$object->info($id);
-
+
$head = fiscalyear_prepare_head($object);
-
+
dol_fiche_head($head, 'info', $langs->trans("FiscalYearCard"), 0, 'cron');
print '';
dol_print_object_info($object);
print '
';
-
+
print '';
}
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 3fb8cbc6927..587a0d387a4 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -29,7 +29,7 @@
*/
require '../../main.inc.php';
-
+
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -118,16 +118,16 @@ if ($result) {
$tabtva = array ();
$tabttc = array ();
$tabcompany = array ();
-
+
$num = $db->num_rows($result);
$i = 0;
-
+
while ( $i < $num ) {
$obj = $db->fetch_object($result);
// les variables
$cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER)) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
-
+
$compta_prod = $obj->compte;
if (empty($compta_prod)) {
if ($obj->product_type == 0)
@@ -137,7 +137,7 @@ if ($result) {
}
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)) ? $conf->global->COMPTA_VAT_ACCOUNT : $langs->trans("CodeNotDef");
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
-
+
// Invoice lines
$tabfac[$obj->rowid]["date"] = $obj->df;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
@@ -156,9 +156,9 @@ if ($result) {
$tabcompany[$obj->rowid] = array (
'id' => $obj->socid,
'name' => $obj->name,
- 'code_client' => $obj->code_compta
+ 'code_client' => $obj->code_compta
);
-
+
$i ++;
}
} else {
@@ -172,7 +172,7 @@ if ($result) {
// Bookkeeping Write
if ($action == 'writebookkeeping') {
$now = dol_now();
-
+
foreach ( $tabfac as $key => $val ) {
foreach ( $tabttc[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);
@@ -190,10 +190,10 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
-
+
$bookkeeping->create();
}
-
+
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) {
@@ -215,12 +215,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
-
+
$bookkeeping->create();
}
}
}
-
+
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
@@ -241,7 +241,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
-
+
$bookkeeping->create();
}
}
@@ -250,21 +250,21 @@ if ($action == 'writebookkeeping') {
// export csv
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
-
+
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_ventes.csv');
-
+
$companystatic = new Client($db);
-
+
if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert
{
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
-
+
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
-
+
print $date . $sep;
print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep;
print length_accountg($conf->global->COMPTA_ACCOUNT_CUSTOMER) . $sep;
@@ -276,7 +276,7 @@ if ($action == 'export_csv') {
}
print $val["ref"];
print "\n";
-
+
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) {
@@ -312,7 +312,7 @@ if ($action == 'export_csv') {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
-
+
$date = dol_print_date($db->jdate($val["date"]), 'day');
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
@@ -323,7 +323,7 @@ if ($action == 'export_csv') {
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
}
print "\n";
-
+
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) {
@@ -336,7 +336,7 @@ if ($action == 'export_csv') {
print "\n";
}
}
-
+
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
@@ -353,11 +353,11 @@ if ($action == 'export_csv') {
}
}
} else {
-
+
$form = new Form($db);
-
+
llxHeader('', $langs->trans("SellsJournal"));
-
+
$nom = $langs->trans("SellsJournal");
$nomlink = '';
$periodlink = '';
@@ -370,11 +370,11 @@ if ($action == 'export_csv') {
$description .= $langs->trans("DepositsAreIncluded");
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
-
+
print ' ';
-
+
print ' ';
-
+
print '
';
-
+
/*
* Show result array
*/
print ' ';
-
+
$i = 0;
print "";
print "";
@@ -404,23 +404,23 @@ if ($action == 'export_csv') {
print "" . $langs->trans("Debit") . " ";
print "" . $langs->trans("Credit") . " ";
print " \n";
-
+
$var = true;
$r = '';
-
+
$invoicestatic = new Facture($db);
$companystatic = new Client($db);
-
+
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
-
+
$date = dol_print_date($db->jdate($val["date"]), 'day');
-
+
print "";
-
+
// Third party
// print "".$conf->global->COMPTA_JOURNAL_SELL." ";
print "" . $date . " ";
@@ -436,7 +436,7 @@ if ($action == 'export_csv') {
print "" . ($mt < 0 ? price(- $mt) : '') . " ";
}
print " ";
-
+
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) {
@@ -451,7 +451,7 @@ if ($action == 'export_csv') {
print "";
}
}
-
+
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
@@ -467,12 +467,12 @@ if ($action == 'export_csv') {
print "";
}
}
-
+
$var = ! $var;
}
-
+
print "
";
-
+
// End of page
llxFooter();
}
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 4015b202d62..a12867c0800 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -55,6 +55,10 @@ $contactid=GETPOST('contactid','int');
$origin=GETPOST('origin','alpha');
$originid=GETPOST('originid','int');
+$fulldayevent=GETPOST('fullday');
+$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
+$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
+
// Security check
$socid = GETPOST('socid','int');
$id = GETPOST('id','int');
@@ -63,6 +67,7 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
$error=GETPOST("error");
+$donotclearsession=0;
$cactioncomm = new CActionComm($db);
$object = new ActionComm($db);
@@ -82,6 +87,19 @@ $hookmanager->initHooks(array('actioncard'));
* Actions
*/
+if (GETPOST('addassignedtouser'))
+{
+ // Add a new user
+ if (GETPOST('affectedto') > 0)
+ {
+ $assignedtouser=array();
+ if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
+ $assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1);
+ $_SESSION['assignedtouser']=dol_json_encode($assignedtouser);
+ }
+ $donotclearsession=1;
+ $action='create';
+}
// Add action
if ($action == 'add_action')
{
@@ -104,12 +122,11 @@ if ($action == 'add_action')
exit;
}
- $fulldayevent=GETPOST('fullday');
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters
- $datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
- $datef=dol_mktime($fulldayevent?'23':$_POST["p2hour"], $fulldayevent?'59':$_POST["p2min"], $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
+ $datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
+ $datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
// Check parameters
if (! $datef && $percentage == 100)
@@ -519,15 +536,16 @@ if ($action == 'create')
print ' '.$langs->trans("EventOnFullDay").' ';
// Date start
- $datep=$object->datep;
+ $datep=($datep?$datep:$object->datep);
if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0);
print ''.$langs->trans("DateActionStart").' ';
if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend');
else if (GETPOST("afaire") == 2) $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldayend');
else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
print ' ';
+
// Date end
- $datef=$object->datef;
+ $datef=($datef?$datef:$object->datef);
if (GETPOST('datef','int',1)) $datef=dol_stringtotime(GETPOST('datef','int',1),0);
print ''.$langs->trans("DateActionEnd").' ';
if (GETPOST("afaire") == 1) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
@@ -539,29 +557,29 @@ if ($action == 'create')
print ' '.$langs->trans("Status").' / '.$langs->trans("Percentage").' ';
print '';
$percent=-1;
- if (isset($_GET['status']) || isset($_POST['status']))
- {
- $percent=GETPOST('status');
- }
- else if (isset($_GET['percentage']) || isset($_POST['percentage']))
- {
- $percent=GETPOST('percentage');
- }
+ if (isset($_GET['status']) || isset($_POST['status'])) $percent=GETPOST('status');
+ else if (isset($_GET['percentage']) || isset($_POST['percentage'])) $percent=GETPOST('percentage');
else
{
- if (GETPOST("afaire") == 1) $percent=0;
- else if (GETPOST("afaire") == 2) $percent=100;
+ if (GETPOST('complete') == '0' || GETPOST("afaire") == 1) $percent='0';
+ else if (GETPOST('complete') == 100 || GETPOST("afaire") == 2) $percent=100;
}
$formactions->form_select_status_action('formaction',$percent,1,'complete');
print ' ';
// Location
- print ''.$langs->trans("Location").' ';
+ print ''.$langs->trans("Location").' ';
// Assigned to
$var=false;
print ''.$langs->trans("ActionAffectedTo").' ';
- $form->select_users(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
+ if (empty($donotclearsession))
+ {
+ $assignedtouser=GETPOST("affectedtouser")?GETPOST("affectedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id);
+ $_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('transparency'=>1,'mandatory'=>1)));
+ }
+ //print $form->select_dolusers_forevent('affectedto',1);
+ print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
print ' ';
print '';
@@ -579,7 +597,7 @@ if ($action == 'create')
if ($conf->global->AGENDA_ENABLE_DONEBY)
{
print ''.$langs->trans("ActionDoneBy").' ';
- $form->select_users(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->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1);
print ' ';
}
@@ -652,7 +670,7 @@ if ($action == 'create')
// Description
print ''.$langs->trans("Description").' ';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90);
+ $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_6,90);
$doleditor->Create();
print ' ';
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 29ad7182e5b..2318c45f132 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -998,7 +998,7 @@ elseif ($action == 'show_week') // View by week
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
if ($today) $style='cal_today';
- echo ' ';
+ echo ' ';
show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo " \n";
}
@@ -1032,7 +1032,7 @@ else // View by day
echo ' '.$langs->trans("Day".$arraytimestamp['wday'])." \n";
echo " \n";
echo " \n";
- echo ' ';
+ echo ' ';
$maxnbofchar=80;
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo " \n";
@@ -1073,18 +1073,20 @@ $db->close();
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
* @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL
- * @param int $showinfo Add extended information (used by day view)
+ * @param int $showinfo Add extended information (used by day and week view)
* @param int $minheight Minimum height for each event. 60px by default.
* @return void
*/
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 $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
+ global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
global $theme_datacolor;
global $cachethirdparties, $cachecontacts, $colorindexused;
print ''."\n";
+
+ // Line with title of day
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
print '
';
print '';
@@ -1092,7 +1094,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
print $newparam;
print '">';
- if ($showinfo) print dol_print_date($curtime,'daytext');
+ if ($showinfo) print dol_print_date($curtime,'daytextshort');
else print dol_print_date($curtime,'%d');
print '';
print ' ';
@@ -1107,7 +1109,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '';
}
print ' ';
- print '';
+
+ // Line with td contains all div of each events
+ print ' ';
+ print '';
//$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
@@ -1192,15 +1197,23 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$cssclass.= " unsortable";
}
+ $h=''; $nowrapontd=1;
+ if ($action == 'show_day') { $h='height: 100%; '; $nowrapontd=0; }
+ if ($action == 'show_week') { $h='height: 100%; '; $nowrapontd=0; }
+
// Show rect of event
- print '
';
- print '
';
- print '';
+ print '';
+ print '';
- print '';
+ print ' ';
if ($event->type_code == 'BIRTHDAY') // It's a birthday
{
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
@@ -1367,6 +1380,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print ''."\n";
}
+ print '';
print ' ';
print '
';
print ''."\n";
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index a9f5438f1b8..a2c75386e56 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -43,6 +43,7 @@ $pid=GETPOST("projectid",'int',3);
$status=GETPOST("status",'alpha');
$type=GETPOST('type');
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':''));
+$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
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);
@@ -178,6 +179,8 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")";
}
+//if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1).'"';
+if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1)."'";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
//print $sql;
@@ -191,9 +194,11 @@ if ($resql)
$num = $db->num_rows($resql);
- $title=$langs->trans("DoneAndToDoActions");
+ /*$title=$langs->trans("DoneAndToDoActions");
if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions");
+ */
+ $title=$langs->trans("ListOfEvents");
$newtitle=$langs->trans($title);
@@ -225,6 +230,8 @@ if ($resql)
print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,$link,$num,0,'');
//print ' ';
+ print '';
+
$db->free($resql);
}
diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php
index 39e72ff7416..1abde51c263 100644
--- a/htdocs/core/class/fiscalyear.class.php
+++ b/htdocs/core/class/fiscalyear.class.php
@@ -54,7 +54,7 @@ class Fiscalyear
function __construct($db)
{
$this->db = $db;
-
+
$this->statuts_short = array(0 => 'Opened', 1 => 'Closed');
$this->statuts = array(0 => 'Opened', 1 => 'Closed');
@@ -70,9 +70,9 @@ class Fiscalyear
function create($user)
{
global $conf;
-
+
$error = 0;
-
+
$now=dol_now();
$this->db->begin();
@@ -88,7 +88,7 @@ class Fiscalyear
$sql.= ") VALUES (";
$sql.= " '".$this->label."'";
$sql.= ", '".$this->db->idate($this->date_start)."'";
- $sql.= ", '".$this->db->idate($this->date_end)."'";
+ $sql.= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'":"null");
$sql.= ", ".$this->statut;
$sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->idate($now)."'";
@@ -109,19 +109,19 @@ class Fiscalyear
}
else
{
- $this->error=$this->db->error();
+ $this->error=$this->db->lasterror();
$this->db->rollback();
return $result;
}
}
else
{
- $this->error=$this->db->error()." sql=".$sql;
+ $this->error=$this->db->lasterror()." sql=".$sql;
$this->db->rollback();
return -1;
}
}
-
+
/**
* Update record
*
@@ -138,15 +138,15 @@ class Fiscalyear
$this->error='ErrorBadParameter';
return -1;
}
-
+
$this->db->begin();
- $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_fiscalyear ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_fiscalyear";
$sql .= " SET label = '".$this->label."'";
$sql .= ", date_start = '".$this->db->idate($this->date_start)."'";
- $sql .= ", date_end = '".$this->db->idate($this->date_end)."'";
+ $sql .= ", date_end = ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= ", statut = '".$this->statut."'";
- $sql .= ", datec = " . ($this->datec != '' ? $this->db->idate($this->datec) : 'null');
+ $sql .= ", datec = " . ($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null');
$sql .= ", fk_user_modif = " . $user->id;
$sql .= " WHERE rowid = ".$this->id;
@@ -160,11 +160,12 @@ class Fiscalyear
else
{
$this->error=$this->db->lasterror();
+ dol_syslog($this->error, LOG_ERR);
$this->db->rollback();
return -1;
}
}
-
+
/**
* Load an object from database
*
@@ -194,11 +195,11 @@ class Fiscalyear
}
else
{
- $this->error=$this->db->error();
+ $this->error=$this->db->lasterror();
return -1;
}
}
-
+
/**
* Delete record
*
@@ -220,12 +221,12 @@ class Fiscalyear
}
else
{
- $this->error=$this->db->error();
+ $this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
-
+
/**
* Give a label from a status
*
@@ -238,7 +239,7 @@ class Fiscalyear
}
/**
- * Give a label from a status
+ * Give a label from a status
*
* @param int $statut Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
@@ -277,7 +278,7 @@ class Fiscalyear
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut8');
}
}
-
+
/**
* Information on record
*
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index d70e9c32c0b..7dfe2b3e7d3 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1273,6 +1273,49 @@ class Form
}
+ /**
+ * Return select list of users. Selected users are stored into session.
+ *
+ * @param string $htmlname Field name in form
+ * @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
+ * @param array $exclude Array list of users id to exclude
+ * @param int $disabled If select list must be disabled
+ * @param array $include Array list of users id to include or 'hierarchy' to have only supervised users
+ * @param array $enableonly Array list of users id to be enabled. All other must be disabled
+ * @param int $force_entity 0 or Id of environment to force
+ * @param int $maxlength Maximum length of string into list (0=no limit)
+ * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
+ * @param string $morefilter Add more filters into sql request
+ * @return string HTML select string
+ * @see select_dolgroups
+ */
+ function select_dolusers_forevent($htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
+ {
+ global $conf,$user,$langs;
+
+ $userstatic=new User($this->db);
+
+ // Method with no ajax
+ //$out.='';
+ return $out;
+ }
+
+
/**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*
@@ -3932,11 +3975,12 @@ class Form
/**
* Return a HTML select string, built from an array of key+value.
+ * Note: Do not use returned string into a langs->trans function, content may be entity encoded twice.
*
* @param string $htmlname Name of html select area
* @param array $array Array with key+value
* @param string $id Preselected key
- * @param int $show_empty 1 si il faut ajouter une valeur vide dans la liste, 0 sinon
+ * @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or ' ').
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
* @param int $value_as_key 1 to use value as key
* @param string $moreparam Add more parameters onto the select tag
@@ -3945,7 +3989,7 @@ class Form
* @param int $disabled Html select box is disabled
* @param int $sort 'ASC' or 'DESC' =Sort on label, '' or 'NONE'=Do not sort
* @param string $morecss Add more class to css styles
- * @return string HTML select string
+ * @return string HTML select string.
*/
static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='')
{
@@ -3982,11 +4026,11 @@ class Form
if ($key_in_label)
{
- $selectOptionValue = dol_htmlentitiesbr($key.' - '.($maxlen?dol_trunc($value,$maxlen):$value));
+ $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen?dol_trunc($value,$maxlen):$value));
}
else
{
- $selectOptionValue = dol_htmlentitiesbr($maxlen?dol_trunc($value,$maxlen):$value);
+ $selectOptionValue = dol_escape_htmltag($maxlen?dol_trunc($value,$maxlen):$value);
if ($value == '' || $value == '-') $selectOptionValue=' ';
}
$out.=$selectOptionValue;
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 5f4f743a45d..27b02e060e8 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -501,14 +501,14 @@ function calendars_prepare_head($param)
$head[$h][2] = 'cardday';
$h++;
- $head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
- $head[$h][1] = $langs->trans("ViewList");
- $head[$h][2] = 'cardlist';
- $h++;
-
$head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewPerUser");
$head[$h][2] = 'cardperuser';
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
+ $head[$h][1] = $langs->trans("ViewList");
+ $head[$h][2] = 'cardlist';
$h++;
$object=new stdClass();
diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php
index f91ec3d188d..673f64e6261 100644
--- a/htdocs/core/lib/ajax.lib.php
+++ b/htdocs/core/lib/ajax.lib.php
@@ -337,7 +337,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
width: "500px" */
$msg = '