diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index ba2a80cfa7d..524e6c04e7a 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -536,8 +536,8 @@ if ($rowid) print ''.$langs->trans("Firstname").''.$object->firstname.' '; print ''; - // EMail - print ''.$langs->trans("EMail").''.dol_print_email($object->email,0,$object->fk_soc,1).''; + // EMail + print ''.$langs->trans("EMail").''.dol_print_email($object->email,0,$object->fk_soc,1).''; // Status print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 344bf615f56..733e8cfdf74 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1504,7 +1504,7 @@ class Adherent extends CommonObject $langs->load("dict"); $code=$this->civilite_id; - return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code); + return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code); } /** @@ -1531,11 +1531,11 @@ class Adherent extends CommonObject $lien = ''; $lienfin=''; } - if ($option == 'category') - { - $lien = ''; - $lienfin=''; - } + if ($option == 'category') + { + $lien = ''; + $lienfin=''; + } $picto='user'; $label=$langs->trans("ShowMember"); diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index c4c62d8285f..1e70df2da8d 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -49,8 +49,8 @@ $backtopage=GETPOST('backtopage','alpha'); $confirm=GETPOST('confirm','alpha'); $rowid=GETPOST('rowid','int'); $typeid=GETPOST('typeid','int'); -$userid=GETPOST('userid','int'); -$socid=GETPOST('socid','int'); +$userid=GETPOST('userid','int'); +$socid=GETPOST('socid','int'); if (! empty($conf->mailmanspip->enabled)) { @@ -249,16 +249,16 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) $lastname=$_POST["lastname"]; $firstname=$_POST["firstname"]; $morphy=$morphy=$_POST["morphy"];; - if ($morphy != 'mor' && empty($lastname)) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."
\n"; - } - if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."
\n"; - } + if ($morphy != 'mor' && empty($lastname)) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."
\n"; + } + if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."
\n"; + } // Create new object if ($result > 0 && ! $error) @@ -383,7 +383,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) else { setEventMessage($object->mesgs, 'mesgs'); - } + } } $rowid=$object->id; @@ -715,7 +715,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object = new Adherent($db); $result=$object->fetch($rowid); - if ($result <= 0) dol_print_error('',$object->error); + if ($result <= 0) dol_print_error('',$object->error); } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template @@ -1409,8 +1409,8 @@ else // Firstname print ''.$langs->trans("Firstname").''.$object->firstname.' '; - // EMail - print ''.$langs->trans("EMail").''.dol_print_email($object->email,0,$object->fk_soc,1).''; + // EMail + print ''.$langs->trans("EMail").''.dol_print_email($object->email,0,$object->fk_soc,1).''; // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 7c1cc07ad69..b84350528d4 100755 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -44,7 +44,7 @@ $year = strftime("%Y", time()); $startyear=$year-2; $endyear=$year; -$langs->load("members"); +$langs->load("members"); $langs->load("companies"); diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 38a47555706..090e414c548 100755 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -23,9 +23,9 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; -$graphwidth=DolGraph::getDefaultGraphSizeForStats('width',700); +$graphwidth=DolGraph::getDefaultGraphSizeForStats('width',700); $mapratio = 0.5; $graphheight = round($graphwidth * $mapratio); @@ -44,7 +44,7 @@ $year = strftime("%Y", time()); $startyear=$year-2; $endyear=$year; -$langs->load("members"); +$langs->load("members"); $langs->load("companies"); diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 7ca24d5bd4f..6d0fcf6bb9e 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -46,8 +46,8 @@ $year = strftime("%Y", time()); $startyear=$year-2; $endyear=$year; -$langs->load("members"); -$langs->load("companies"); +$langs->load("members"); +$langs->load("companies"); /* diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index d5bdedc01d5..31d313b84e9 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -347,7 +347,7 @@ foreach($boxtoadd as $box) print ''; print ''; print ''.img_object("",$logo).' '.$langs->transnoentitiesnoconv($box->boxlabel); - if (! empty($box->class) && preg_match('/graph_/',$box->class)) print ' ('.$langs->trans("Graph").')'; + if (! empty($box->class) && preg_match('/graph_/',$box->class)) print ' ('.$langs->trans("Graph").')'; print ''; print ''; if ($box->note == '(WarningUsingThisBoxSlowDown)') diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 726bd912964..41a3f02838d 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -84,11 +84,11 @@ print '
'; print $langs->trans("ClickToDialUrlDesc").'
'; print $langs->trans("Example").':
http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; -//if (! empty($user->clicktodial_url)) -//{ - print '
'; - print info_admin($langs->trans("ValueOverwrittenByUserSetup")); -//} +//if (! empty($user->clicktodial_url)) +//{ + print '
'; + print info_admin($langs->trans("ValueOverwrittenByUserSetup")); +//} print ''; @@ -113,9 +113,9 @@ if (! empty($conf->global->CLICKTODIAL_URL)) print ''; $setupcomplete=1; - if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0; - if (preg_match('/__PASSWORD__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete=0; - if (preg_match('/__PHONEFROM__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0; + if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0; + if (preg_match('/__PASSWORD__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete=0; + if (preg_match('/__PHONEFROM__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0; if ($setupcomplete) { diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 391b399ceaa..bc586140250 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -44,8 +44,8 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); -$label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$label = GETPOST('label','alpha'); +$scandir = GETPOST('scandir','alpha'); $type = 'order'; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 4f7f0729472..5da3ad27183 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -40,8 +40,8 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); -$label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$label = GETPOST('label','alpha'); +$scandir = GETPOST('scandir','alpha'); $type='invoice'; @@ -158,19 +158,19 @@ else if ($action == 'del') // Set default model else if ($action == 'setdoc') { - if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$value,'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->FACTURE_ADDON_PDF = $value; - } - - // On active le modele - $ret = delDocumentModel($value, $type); - if ($ret > 0) - { - $ret = addDocumentModel($value, $type, $label, $scandir); - } + if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$value,'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->FACTURE_ADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } } else if ($action == 'setmod') diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index c6e2819f5d7..bbb2c60e51f 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -23,8 +23,8 @@ */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->load("admin"); @@ -48,18 +48,18 @@ if (isset($title)) -print ''; -print ''; -print "\n"; - +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; +print ''; +print "\n"; + $var=false; -// Recupere la version de l'OS -$phpversion=version_php(); -print "\n"; +// Recupere la version de l'OS +$phpversion=version_php(); +print "\n"; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Version")."".$phpversion."
'.$langs->trans("Version")."".$phpversion."
'; -print '
'; +print '
'; diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index 3d9ebbd1d29..980bd9ef4bb 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -52,27 +52,27 @@ $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/'; $interfaces = new Interfaces($db); $triggers = $interfaces->getTriggersList(0,'priority'); -print ' - - - - - +print '
'.$langs->trans("File").''.$langs->trans("Active").' 
+ + + + + '; - -$var=True; -foreach ($triggers as $trigger) -{ - $var=!$var; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; -} - -print '
'.$langs->trans("File").''.$langs->trans("Active").' 
'.$trigger['picto'].''.$trigger['file'].''.$trigger['status'].''.$form->textwithpicto('', $trigger['info']).'
'; + +$var=True; +foreach ($triggers as $trigger) +{ + $var=!$var; + print ''; + print ''.$trigger['picto'].''; + print ''.$trigger['file'].''; + print ''.$trigger['status'].''; + print ''.$form->textwithpicto('', $trigger['info']).''; + print ''; +} + +print ''; llxFooter(); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 19e8b1a9f5d..50950506778 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -379,7 +379,7 @@ class Categorie { if ($this->id == -1) return -2; if ($type == 'company') $type='societe'; - if ($type == 'fournisseur') $type='societe'; + if ($type == 'fournisseur') $type='societe'; $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$type.")"; $sql .= " VALUES (".$this->id.", ".$obj->id.")"; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 4e9f376977c..bd293f9febb 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -127,7 +127,7 @@ else print ' '; //print ''; print ''; -print '

'; +print '

'; // Charge tableau des categories diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 36ed1bd4ded..3cdb5d516f1 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -36,7 +36,7 @@ $ref=GETPOST('ref'); $type=GETPOST('type'); $action=GETPOST('action'); $confirm=GETPOST('confirm'); -$removeelem = GETPOST('removeelem','int'); +$removeelem = GETPOST('removeelem','int'); if ($id == "") { @@ -62,39 +62,39 @@ $type=$object->type; * Actions */ -// Remove element from category -if ($id > 0 && $removeelem > 0) -{ - if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) - { - require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $tmpobject = new Product($db); - $result = $tmpobject->fetch($removeelem); - $elementtype = 'product'; - } - if ($type==1 && $user->rights->societe->creer) - { - $tmpobject = new Societe($db); - $result = $tmpobject->fetch($removeelem); - $elementtype = 'fournisseur'; - } - if ($type==2 && $user->rights->societe->creer) - { - $tmpobject = new Societe($db); - $result = $tmpobject->fetch($removeelem); - $elementtype = 'societe'; - } - if ($type == 3 && $user->rights->adherent->creer) +// Remove element from category +if ($id > 0 && $removeelem > 0) +{ + if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) { - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $tmpobject = new Adherent($db); - $result = $tmpobject->fetch($removeelem); + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $tmpobject = new Product($db); + $result = $tmpobject->fetch($removeelem); + $elementtype = 'product'; + } + if ($type==1 && $user->rights->societe->creer) + { + $tmpobject = new Societe($db); + $result = $tmpobject->fetch($removeelem); + $elementtype = 'fournisseur'; + } + if ($type==2 && $user->rights->societe->creer) + { + $tmpobject = new Societe($db); + $result = $tmpobject->fetch($removeelem); + $elementtype = 'societe'; + } + if ($type == 3 && $user->rights->adherent->creer) + { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + $tmpobject = new Adherent($db); + $result = $tmpobject->fetch($removeelem); $elementtype = 'member'; - } - + } + $result=$object->del_type($tmpobject,$elementtype); - if ($result < 0) dol_print_error('',$object->error); -} + if ($result < 0) dol_print_error('',$object->error); +} if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { @@ -312,21 +312,21 @@ if ($object->type == 1) print ''; print $soc->getNomUrl(1,'category_supplier'); print "\n"; - // Link to delete from category - print ''; - $typeid=$object->type; - $permission=0; - if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); - if ($typeid == 1) $permission=$user->rights->societe->creer; - if ($typeid == 2) $permission=$user->rights->societe->creer; - if ($typeid == 3) $permission=$user->rights->adherent->creer; - if ($permission) - { - print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; - } - print ''; + // Link to delete from category + print ''; + $typeid=$object->type; + $permission=0; + if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == 1) $permission=$user->rights->societe->creer; + if ($typeid == 2) $permission=$user->rights->societe->creer; + if ($typeid == 3) $permission=$user->rights->adherent->creer; + if ($permission) + { + print ""; + print img_delete($langs->trans("DeleteFromCat")).' '; + print $langs->trans("DeleteFromCat").""; + } + print ''; print "\n"; } @@ -364,20 +364,20 @@ if($object->type == 2) print ''; print $soc->getNomUrl(1,'category'); print "\n"; - // Link to delete from category - print ''; - $typeid=$object->type; - $permission=0; - if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); - if ($typeid == 1) $permission=$user->rights->societe->creer; - if ($typeid == 2) $permission=$user->rights->societe->creer; - if ($typeid == 3) $permission=$user->rights->adherent->creer; - if ($permission) - { - print ""; - print img_delete($langs->trans("DeleteFromCat")).' '; - print $langs->trans("DeleteFromCat").""; - } + // Link to delete from category + print ''; + $typeid=$object->type; + $permission=0; + if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == 1) $permission=$user->rights->societe->creer; + if ($typeid == 2) $permission=$user->rights->societe->creer; + if ($typeid == 3) $permission=$user->rights->adherent->creer; + if ($permission) + { + print ""; + print img_delete($langs->trans("DeleteFromCat")).' '; + print $langs->trans("DeleteFromCat").""; + } print ''; print "\n"; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index bb30efe8ef9..f4bb4542843 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -334,7 +334,7 @@ class ActionComm extends CommonObject $this->priority = $obj->priority; $this->fulldayevent = $obj->fulldayevent; $this->location = $obj->location; - $this->transparency = $obj->transparency; + $this->transparency = $obj->transparency; $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working $this->societe->id = $obj->fk_soc; @@ -476,7 +476,7 @@ class ActionComm extends CommonObject $sql.= ", priority = '".$this->priority."'"; $sql.= ", fulldayevent = '".$this->fulldayevent."'"; $sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null"); - $sql.= ", transparency = '".$this->transparency."'"; + $sql.= ", transparency = '".$this->transparency."'"; $sql.= ", fk_user_mod = '".$user->id."'"; $sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null"); $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 4b438786d56..94a6e276a89 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -523,8 +523,8 @@ if ($action == 'create') // Busy print ''.$langs->trans("Busy").''; - print ''; - print ''; + print ''; + print ''; // Realised by if ($conf->global->AGENDA_ENABLE_DONEBY) @@ -764,13 +764,13 @@ if ($id > 0) print ''; // Busy - print ''.$langs->trans("Busy").''; + print ''.$langs->trans("Busy").''; print 'transparency?' checked="checked"':'').'">'; - print ''; - + print ''; + // Realised by - if ($conf->global->AGENDA_ENABLE_DONEBY) - { + if ($conf->global->AGENDA_ENABLE_DONEBY) + { print ''.$langs->trans("ActionDoneBy").''; print $form->select_dolusers($act->userdone->id> 0?$act->userdone->id:-1,'doneby',1); print ''; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index fd9df1ea848..f95842884bb 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -76,7 +76,7 @@ $pid=GETPOST("projectid","int",3); $status=GETPOST("status"); $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); -$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=="0"?'':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); +$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=="0"?'':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); if (GETPOST('viewcal')) { $action='show_month'; $day=''; @@ -1014,17 +1014,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { // Define color index if not yet defined $idusertouse=($event->usertodo->id?$event->usertodo->id:0); - if (isset($colorindexused[$idusertouse])) - { - $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user - } - else - { - $colorindex=$nextindextouse; - $colorindexused[$idusertouse]=$colorindex; - if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color - } - //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'
'; + if (isset($colorindexused[$idusertouse])) + { + $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user + } + else + { + $colorindex=$nextindextouse; + $colorindexused[$idusertouse]=$colorindex; + if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color + } + //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'
'; // Define color $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index fbc76d402e1..f32fa89b59b 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -249,7 +249,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) } -print '
'; +print '
'; $NBMAX=3; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 08b0e150227..dfb84f5a01d 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -375,7 +375,7 @@ if ($object->fetch($id) >= 0) if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname); if ($search_email) $param.= "&search_email=".urlencode($search_email); - $cleartext='
'.$langs->trans("ToClearAllRecipientsClickHere").': '.''; + $cleartext='
'.$langs->trans("ToClearAllRecipientsClickHere").': '.''; print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$object->nbemail,''); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c8d0bfeebde..db8dd255b6c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1797,10 +1797,10 @@ class Propal extends CommonObject $sql.= " WHERE p.entity = ".$conf->entity; $sql.= " AND p.fk_soc = s.rowid"; $sql.= " AND p.fk_statut = c.id"; - if (! $user->rights->societe->client->voir && ! $socid) //restriction - { - $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - } + if (! $user->rights->societe->client->voir && ! $socid) //restriction + { + $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + } if ($socid) $sql.= " AND s.rowid = ".$socid; if ($draft) $sql.= " AND p.fk_statut = 0"; if ($notcurrentuser > 0) $sql.= " AND p.fk_user_author <> ".$user->id; diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 54ddc846272..34584c7f99e 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -26,7 +26,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php'; include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; -include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; /** diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 508f9a70fc6..edfbb35f5cd 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2026,19 +2026,19 @@ class Commande extends CommonOrder { $obj = $this->db->fetch_object($result); - if ($shortlist == 1) - { - $ga[$obj->cid] = $obj->ref; - } - else if ($shortlist == 2) - { - $ga[$obj->cid] = $obj->ref.' ('.$obj->name.')'; - } - else - { - $ga[$i]['id'] = $obj->cid; - $ga[$i]['ref'] = $obj->ref; - $ga[$i]['name'] = $obj->name; + if ($shortlist == 1) + { + $ga[$obj->cid] = $obj->ref; + } + else if ($shortlist == 2) + { + $ga[$obj->cid] = $obj->ref.' ('.$obj->name.')'; + } + else + { + $ga[$i]['id'] = $obj->cid; + $ga[$i]['ref'] = $obj->ref; + $ga[$i]['name'] = $obj->name; } $i++; } diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 56c69d84541..40714e98811 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -26,7 +26,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php'; include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; -include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; /** diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index a02dff6b868..5c9edf478e1 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -35,10 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("bills"); $id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int')); diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index 402dbeda095..dbe67212f37 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -27,10 +27,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("bills"); $action=GETPOST('action'); diff --git a/htdocs/compta/bank/bilan.php b/htdocs/compta/bank/bilan.php index 2224627cd94..a5e6605ad85 100644 --- a/htdocs/compta/bank/bilan.php +++ b/htdocs/compta/bank/bilan.php @@ -23,10 +23,10 @@ */ require('../../main.inc.php'); -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); if (!$user->rights->banque->lire) accessforbidden(); diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index e14b3e92df6..672e1363d3e 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -24,10 +24,10 @@ */ require('../../main.inc.php'); -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); // Security check if ($user->societe_id) $socid=$user->societe_id; diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index ab589e89001..94370d699e6 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -112,8 +112,8 @@ llxHeader(); print_fiche_titre($langs->trans("Rubriques")); -print '
'; -print ''; +print ''; +print ''; print ''; print ''; @@ -160,7 +160,7 @@ if ($result) $db->free($result); } -print ""; +print ""; /* * Line to add category @@ -176,7 +176,7 @@ if ($action != 'edit') print "
"; -print ""; +print ""; llxFooter(); diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index daee366ebdb..407a5398dc5 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -29,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("companies"); $action=GETPOST("action"); diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 932acf5dcb5..3954edf99ee 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -27,12 +27,12 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; - -$langs->load("banks"); -$langs->load("categories"); -$WIDTH=DolGraph::getDefaultGraphSizeForStats('width',768); -$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height',200); +$langs->load("banks"); +$langs->load("categories"); + +$WIDTH=DolGraph::getDefaultGraphSizeForStats('width',768); +$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height',200); // Security check if (isset($_GET["account"]) || isset($_GET["ref"])) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 344231cea5d..51b7a4dc818 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -27,10 +27,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); // Security check if ($user->societe_id) $socid=$user->societe_id; diff --git a/htdocs/compta/bank/info.php b/htdocs/compta/bank/info.php index a4a871cec93..a5a0cdf1677 100644 --- a/htdocs/compta/bank/info.php +++ b/htdocs/compta/bank/info.php @@ -24,10 +24,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("companies"); diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index da28602314a..29a47a60e9b 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -31,10 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("bills"); if (! $user->rights->banque->consolidate) accessforbidden(); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 2d9ac9cd86e..b62ea51118c 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -25,16 +25,16 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("companies"); $langs->load("bills"); @@ -82,14 +82,14 @@ $pagenext = $page + 1; llxHeader(); $form = new Form($db); -$societestatic=new Societe($db); -$chargestatic=new ChargeSociales($db); -$memberstatic=new Adherent($db); -$paymentstatic=new Paiement($db); -$paymentsupplierstatic=new PaiementFourn($db); -$paymentvatstatic=new TVA($db); -$bankstatic=new Account($db); -$banklinestatic=new AccountLine($db); +$societestatic=new Societe($db); +$chargestatic=new ChargeSociales($db); +$memberstatic=new Adherent($db); +$paymentstatic=new Paiement($db); +$paymentsupplierstatic=new PaiementFourn($db); +$paymentvatstatic=new TVA($db); +$bankstatic=new Account($db); +$banklinestatic=new AccountLine($db); // Load account @@ -332,59 +332,59 @@ else if ($links[$key]['type']=='payment') { $paymentstatic->id=$links[$key]['url_id']; - $paymentstatic->ref=$langs->trans("Payment"); + $paymentstatic->ref=$langs->trans("Payment"); print ' '.$paymentstatic->getNomUrl(1); $newline=0; } elseif ($links[$key]['type']=='payment_supplier') { - $paymentsupplierstatic->id=$links[$key]['url_id']; - $paymentsupplierstatic->ref=$langs->trans("Payment");; + $paymentsupplierstatic->id=$links[$key]['url_id']; + $paymentsupplierstatic->ref=$langs->trans("Payment");; print ' '.$paymentsupplierstatic->getNomUrl(1); $newline=0; } elseif ($links[$key]['type']=='payment_sc') { - print ''; - print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; - print $langs->trans("SocialContributionPayment"); - print ''; + print ''; + print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; + print $langs->trans("SocialContributionPayment"); + print ''; $newline=0; } - elseif ($links[$key]['type']=='payment_vat') - { - $paymentvatstatic->id=$links[$key]['url_id']; - $paymentvatstatic->ref=$langs->trans("Payment"); - print ' '.$paymentvatstatic->getNomUrl(2); - } + elseif ($links[$key]['type']=='payment_vat') + { + $paymentvatstatic->id=$links[$key]['url_id']; + $paymentvatstatic->ref=$langs->trans("Payment"); + print ' '.$paymentvatstatic->getNomUrl(2); + } elseif ($links[$key]['type']=='banktransfert') { - // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. - if ($objp->amount > 0) - { - $banklinestatic->fetch($links[$key]['url_id']); - $bankstatic->id=$banklinestatic->fk_account; - $bankstatic->label=$banklinestatic->bank_account_label; - print ' ('.$langs->trans("from").' '; - print $bankstatic->getNomUrl(1,'transactions'); - print ' '.$langs->trans("toward").' '; - $bankstatic->id=$objp->bankid; - $bankstatic->label=$objp->bankref; - print $bankstatic->getNomUrl(1,''); - print ')'; - } - else - { - $bankstatic->id=$objp->bankid; - $bankstatic->label=$objp->bankref; - print ' ('.$langs->trans("from").' '; - print $bankstatic->getNomUrl(1,''); - print ' '.$langs->trans("toward").' '; - $banklinestatic->fetch($links[$key]['url_id']); - $bankstatic->id=$banklinestatic->fk_account; - $bankstatic->label=$banklinestatic->bank_account_label; - print $bankstatic->getNomUrl(1,'transactions'); - print ')'; - } + // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. + if ($objp->amount > 0) + { + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_label; + print ' ('.$langs->trans("from").' '; + print $bankstatic->getNomUrl(1,'transactions'); + print ' '.$langs->trans("toward").' '; + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + print $bankstatic->getNomUrl(1,''); + print ')'; + } + else + { + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + print ' ('.$langs->trans("from").' '; + print $bankstatic->getNomUrl(1,''); + print ' '.$langs->trans("toward").' '; + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_label; + print $bankstatic->getNomUrl(1,'transactions'); + print ')'; + } } elseif ($links[$key]['type']=='company') { print ''; diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index bdfda680d6d..ea7d29beb0f 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -27,8 +27,8 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; $langs->load("banks"); $langs->load("categories"); diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 91f05a2fdaa..af7078421a2 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -29,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("bills"); // Security check diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index f770c5bc371..bea66e6a47d 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -26,10 +26,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); if (! $user->rights->banque->transfer) accessforbidden(); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index eade2e3c13d..d6c1465937f 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -205,7 +205,7 @@ complete_head_from_modules($conf,$langs,null,$head,$h,'trip_stats'); dol_fiche_head($head,'byyear',$langs->trans("Statistics")); -print '
'; +print '
'; // Show filter box diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 250605f386b..3663e71ffde 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2687,7 +2687,7 @@ else if ($id > 0 || ! empty($ref)) print $formconfirm; - + // Invoice content diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c45e52bec39..bd0bbaf121e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2660,77 +2660,77 @@ class Facture extends CommonInvoice } - /** - * Return list of invoices (eventually filtered on a user) into an array - * - * @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name) - * @param int $draft 0=not draft, 1=draft - * @param User $excluser Objet user to exclude - * @param int $socid Id third pary - * @param int $limit For pagination - * @param int $offset For pagination - * @param string $sortfield Sort criteria - * @param string $sortorder Sort order - * @return int -1 if KO, array with result if OK - */ - function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='f.datef,f.rowid', $sortorder='DESC') - { - global $conf,$user; - - $ga = array(); - - $sql = "SELECT s.rowid, s.nom as name, s.client,"; - $sql.= " f.rowid as fid, f.facnumber as ref, f.datef as df"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE f.entity = ".$conf->entity; - $sql.= " AND f.fk_soc = s.rowid"; - if (! $user->rights->societe->client->voir && ! $socid) //restriction - { - $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - } - if ($socid) $sql.= " AND s.rowid = ".$socid; - if ($draft) $sql.= " AND f.fk_statut = 0"; - if (is_object($excluser)) $sql.= " AND f.fk_user_author <> ".$excluser->id; - $sql.= $this->db->order($sortfield,$sortorder); - $sql.= $this->db->plimit($limit,$offset); - - $result=$this->db->query($sql); - if ($result) - { - $numc = $this->db->num_rows($result); - if ($numc) - { - $i = 0; - while ($i < $numc) - { - $obj = $this->db->fetch_object($result); - - if ($shortlist == 1) - { - $ga[$obj->fid] = $obj->ref; - } - else if ($shortlist == 2) - { - $ga[$obj->fid] = $obj->ref.' ('.$obj->name.')'; - } - else - { - $ga[$i]['id'] = $obj->fid; - $ga[$i]['ref'] = $obj->ref; - $ga[$i]['name'] = $obj->name; - } - $i++; - } - } - return $ga; - } - else - { - dol_print_error($this->db); - return -1; - } + /** + * Return list of invoices (eventually filtered on a user) into an array + * + * @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name) + * @param int $draft 0=not draft, 1=draft + * @param User $excluser Objet user to exclude + * @param int $socid Id third pary + * @param int $limit For pagination + * @param int $offset For pagination + * @param string $sortfield Sort criteria + * @param string $sortorder Sort order + * @return int -1 if KO, array with result if OK + */ + function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='f.datef,f.rowid', $sortorder='DESC') + { + global $conf,$user; + + $ga = array(); + + $sql = "SELECT s.rowid, s.nom as name, s.client,"; + $sql.= " f.rowid as fid, f.facnumber as ref, f.datef as df"; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE f.entity = ".$conf->entity; + $sql.= " AND f.fk_soc = s.rowid"; + if (! $user->rights->societe->client->voir && ! $socid) //restriction + { + $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + } + if ($socid) $sql.= " AND s.rowid = ".$socid; + if ($draft) $sql.= " AND f.fk_statut = 0"; + if (is_object($excluser)) $sql.= " AND f.fk_user_author <> ".$excluser->id; + $sql.= $this->db->order($sortfield,$sortorder); + $sql.= $this->db->plimit($limit,$offset); + + $result=$this->db->query($sql); + if ($result) + { + $numc = $this->db->num_rows($result); + if ($numc) + { + $i = 0; + while ($i < $numc) + { + $obj = $this->db->fetch_object($result); + + if ($shortlist == 1) + { + $ga[$obj->fid] = $obj->ref; + } + else if ($shortlist == 2) + { + $ga[$obj->fid] = $obj->ref.' ('.$obj->name.')'; + } + else + { + $ga[$i]['id'] = $obj->fid; + $ga[$i]['ref'] = $obj->ref; + $ga[$i]['name'] = $obj->name; + } + $i++; + } + } + return $ga; + } + else + { + dol_print_error($this->db); + return -1; + } } @@ -3121,7 +3121,7 @@ class Facture extends CommonInvoice $this->total_tva += $line->total_tva; $this->total_ttc += $line->total_ttc; } - $this->revenuestamp = 0; + $this->revenuestamp = 0; // Add a line "offered" $line=new FactureLigne($this->db); diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 4abff5b63be..ffdc17e0e63 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -54,8 +54,8 @@ $endyear=$year; * View */ -$langs->load("bills"); -$langs->load("companies"); +$langs->load("bills"); +$langs->load("companies"); $form=new Form($db); diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index 8a24ab3ce29..3251b4a1ab6 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -29,9 +29,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); + +$langs->load("banks"); +$langs->load("categories"); $langs->load('bills'); $langs->load('companies'); $langs->load('compta'); diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index cfde42a5cf3..80ea9ea6817 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -26,9 +26,9 @@ require('../../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); + +$langs->load("banks"); +$langs->load("categories"); // Security check if ($user->societe_id) $socid=$user->societe_id; diff --git a/htdocs/compta/paiement/cheque/liste.php b/htdocs/compta/paiement/cheque/liste.php index 8370bd95551..705bc15eb88 100644 --- a/htdocs/compta/paiement/cheque/liste.php +++ b/htdocs/compta/paiement/cheque/liste.php @@ -26,9 +26,9 @@ require('../../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); + +$langs->load("banks"); +$langs->load("categories"); $langs->load("bills"); // Security check diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index e5dd9e60ea4..7ef5f44fb88 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -392,7 +392,7 @@ class Paiement extends CommonObject $this->error='Bad value for parameter accountid'; dol_syslog(get_class($this).'::addPaymentToBank '.$this->error, LOG_ERR); return -1; - } + } $this->db->begin(); diff --git a/htdocs/compta/prelevement/bon.php b/htdocs/compta/prelevement/bon.php index 89b40e095bc..b1bcbb3d04b 100644 --- a/htdocs/compta/prelevement/bon.php +++ b/htdocs/compta/prelevement/bon.php @@ -27,10 +27,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("bills"); $langs->load("categories"); diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index ce33322d03a..8f2d336defe 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -26,10 +26,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("widthdrawals"); // Security check diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index f9d770111a7..ddf8a988b48 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -30,10 +30,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("widthdrawals"); $langs->load("companies"); $langs->load("bills"); diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 3012a70bd55..3ae2b850aac 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -28,10 +28,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/modules/modPrelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("widthdrawals"); $langs->load("companies"); diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index ec8eaa51479..115a7829374 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -29,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("companies"); $langs->load('withdrawals'); $langs->load('bills'); diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index c77a0ab6682..87516c3ad65 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -29,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load('withdrawals'); $langs->load('bills'); diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 161df078aae..5fcd70b1a9b 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -27,11 +27,11 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); -$langs->load("withdrawals"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); +$langs->load("withdrawals"); // Security check if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php index a7ebf00c950..22af3b3548d 100644 --- a/htdocs/compta/prelevement/fiche.php +++ b/htdocs/compta/prelevement/fiche.php @@ -26,10 +26,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); if (!$user->rights->prelevement->bons->lire) accessforbidden(); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index d3823cc130e..56a7529fd9a 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -31,10 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.p require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("withdrawals"); // Security check diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index 28358dc75f5..54aaf02841a 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -29,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.p require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); // Security check if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php index 445f1e66755..c322142b6a9 100644 --- a/htdocs/compta/prelevement/lignes.php +++ b/htdocs/compta/prelevement/lignes.php @@ -30,10 +30,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.p require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); // Security check if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php index d3d8634d64a..cd09dc6cf25 100644 --- a/htdocs/compta/prelevement/liste.php +++ b/htdocs/compta/prelevement/liste.php @@ -26,9 +26,9 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); $langs->load("withdrawals"); $langs->load("companies"); $langs->load("categories"); diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index b33a5fd2455..5744ab0eb7b 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -28,10 +28,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("withdrawals"); $langs->load("companies"); diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 34ffdb168b5..418d733dbd4 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -26,10 +26,10 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$langs->load("banks"); +$langs->load("categories"); $langs->load("withdrawals"); $langs->load("companies"); diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index a31b4030b65..f36fd0be5a5 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -41,7 +41,7 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); -$tva = new Tva($db); +$tva = new Tva($db); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('taxvatcard')); @@ -54,7 +54,7 @@ $hookmanager->initHooks(array('taxvatcard')); if ($_POST["cancel"] == $langs->trans("Cancel")) { - header("Location: reglement.php"); + header("Location: reglement.php"); exit; } @@ -231,9 +231,9 @@ if ($id) print $vatpayment->ref; print ''; - // Label - print ''.$langs->trans("Label").''.$vatpayment->label.''; - + // Label + print ''.$langs->trans("Label").''.$vatpayment->label.''; + print ""; print ''.$langs->trans("DatePayment").''; print dol_print_date($vatpayment->datep,'day'); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index fb1ce97fd01..90bd7861435 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1009,13 +1009,13 @@ class Contact extends CommonObject $this->country = 'France'; $this->email = 'specimen@specimen.com'; - $this->phone_pro = '0909090901'; - $this->phone_perso = '0909090902'; - $this->phone_mobile = '0909090903'; - $this->fax = '0909090909'; + $this->phone_pro = '0909090901'; + $this->phone_perso = '0909090902'; + $this->phone_mobile = '0909090903'; + $this->fax = '0909090909'; - $this->note_public='This is a comment (public)'; - $this->note_private='This is a comment (private)'; + $this->note_public='This is a comment (public)'; + $this->note_private='This is a comment (private)'; $socid = rand(1, $num_socs); $this->socid = $socids[$socid]; diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index c876c67fe01..27a56b48825 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $action = GETPOST('action'); @@ -66,7 +66,7 @@ else if ($action == 'setnote_private' && $user->rights->societe->creer) * View */ -$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); +$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $form = new Form($db); @@ -90,68 +90,68 @@ if ($id > 0) print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Name - print ''; - print ''; - - // Company - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) - { - if ($object->socid > 0) - { - $objsoc = new Societe($db); - $objsoc->fetch($object->socid); - - print ''; - } - - else - { - print ''; - } - } - - // Civility - print ''; - - // Date To Birth - print ''; - if (! empty($object->birthday)) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - - print ''; - } - else - { - print '"; - } - print ""; + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Name + print ''; + print ''; + + // Company + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + if ($object->socid > 0) + { + $objsoc = new Societe($db); + $objsoc->fetch($object->socid); + + print ''; + } + + else + { + print ''; + } + } + + // Civility + print ''; + + // Date To Birth + print ''; + if (! empty($object->birthday)) + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + + print ''; + } + else + { + print '"; + } + print ""; print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback); - print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.''.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("Company").''; - print $langs->trans("ContactNotLinkedToCompany"); - print '
'.$langs->trans("UserTitle").''; - print $object->getCivilityLabel(); - print '
'.$langs->trans("DateToBirth").''.dol_print_date($object->birthday,"day"); - - print '   '; - //var_dump($birthdatearray); - $ageyear=convertSecondToTime($now-$object->birthday,'year')-1970; - $agemonth=convertSecondToTime($now-$object->birthday,'month')-1; - if ($ageyear >= 2) print '('.$ageyear.' '.$langs->trans("DurationYears").')'; - else if ($agemonth >= 2) print '('.$agemonth.' '.$langs->trans("DurationMonths").')'; - else print '('.$agemonth.' '.$langs->trans("DurationMonth").')'; - - - print '   -   '; - if ($object->birthday_alert) print $langs->trans("BirthdayAlertOn"); - else print $langs->trans("BirthdayAlertOff"); - print ''.$langs->trans("DateToBirth").''.$langs->trans("Unknown")."
'.$langs->trans("Ref").''; + print $form->showrefnav($object, 'id', $linkback); + print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.''.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("Company").''; + print $langs->trans("ContactNotLinkedToCompany"); + print '
'.$langs->trans("UserTitle").''; + print $object->getCivilityLabel(); + print '
'.$langs->trans("DateToBirth").''.dol_print_date($object->birthday,"day"); + + print '   '; + //var_dump($birthdatearray); + $ageyear=convertSecondToTime($now-$object->birthday,'year')-1970; + $agemonth=convertSecondToTime($now-$object->birthday,'month')-1; + if ($ageyear >= 2) print '('.$ageyear.' '.$langs->trans("DurationYears").')'; + else if ($agemonth >= 2) print '('.$agemonth.' '.$langs->trans("DurationMonths").')'; + else print '('.$agemonth.' '.$langs->trans("DurationMonth").')'; + + + print '   -   '; + if ($object->birthday_alert) print $langs->trans("BirthdayAlertOn"); + else print $langs->trans("BirthdayAlertOff"); + print ''.$langs->trans("DateToBirth").''.$langs->trans("Unknown")."
"; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index ad0da9451e9..d0b59b67dd7 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -42,21 +42,21 @@ class box_activity extends ModeleBoxes var $info_box_contents = array(); - /** - * Constructor - * - * @param DoliDB $db Database handler - * @param string $param More parameters - */ - function __construct($db,$param) - { - global $conf; - - $this->db=$db; + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + function __construct($db,$param) + { + global $conf; + + $this->db=$db; // FIXME: Use a cache to save data because this slow down too much main home page. This box slow down too seriously software. // FIXME: Removed number_format (not compatible with all languages) // FIXME: Pb into some status - $this->enabled=$conf->global->MAIN_FEATURES_LEVEL; // Not enabled by default due to bugs (see previous FIXME) + $this->enabled=$conf->global->MAIN_FEATURES_LEVEL; // Not enabled by default due to bugs (see previous FIXME) } /** diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 3ec5add8a05..5bce26306f3 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -39,18 +39,18 @@ class box_graph_invoices_permonth extends ModeleBoxes var $info_box_contents = array(); - /** - * Constructor - * - * @param DoliDB $db Database handler - * @param string $param More parameters - */ - function __construct($db,$param) + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + function __construct($db,$param) { global $conf; - - $this->db=$db; - $this->enabled=$conf->global->MAIN_FEATURES_LEVEL; + + $this->db=$db; + $this->enabled=$conf->global->MAIN_FEATURES_LEVEL; } /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2cbf113b362..419174a31dc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -81,24 +81,24 @@ abstract class CommonObject return dol_trunc($ret,$maxlen); } - /** - * Return full address of contact - * - * @param int $withcountry 1=Add country into address string - * @param string $sep Separator to use to build string - * @return string Full address string - */ - function getFullAddress($withcountry=0,$sep="\n") - { - if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country))) - { - require_once DOL_DOCUMENT_ROOT .'/core/lib/company.lib.php'; - $tmparray=getCountry($this->country_id,'all'); - $this->country_code=$tmparray['code']; - $this->country =$tmparray['label']; - } + /** + * Return full address of contact + * + * @param int $withcountry 1=Add country into address string + * @param string $sep Separator to use to build string + * @return string Full address string + */ + function getFullAddress($withcountry=0,$sep="\n") + { + if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country))) + { + require_once DOL_DOCUMENT_ROOT .'/core/lib/company.lib.php'; + $tmparray=getCountry($this->country_id,'all'); + $this->country_code=$tmparray['code']; + $this->country =$tmparray['label']; + } - return dol_format_address($this, $withcountry, $sep); + return dol_format_address($this, $withcountry, $sep); } /** diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index a7a8fe04903..4ce1bbf8c3d 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -63,11 +63,11 @@ class Conf //! Used to store list of entities to use for each element public $entities = array(); - public $dol_hide_topmenu; // Set if we force param dol_hide_topmenu into login url - public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url - public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone - public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone - public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url + public $dol_hide_topmenu; // Set if we force param dol_hide_topmenu into login url + public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url + public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone + public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone + public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url /** diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 58c7063e40a..43722bb59f2 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -166,8 +166,8 @@ class HookManager } } - if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); - if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; + if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); + if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; } // Generic hooks that return a string or array (printSearchForm, printLeftBlock, printTopRightMenu, formAddObjectLine, formBuilddocOptions, ...) else diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6501dd94ef8..d68d9c8d59f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -702,13 +702,13 @@ class Form $selected_input_value=$product->ref; } ======= - if ($selected && empty($selected_input_value)) - { - require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $product = new Product($this->db); - $product->fetch($selected); - $selected_input_value=$product->ref; - } + if ($selected && empty($selected_input_value)) + { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $product = new Product($this->db); + $product->fetch($selected); + $selected_input_value=$product->ref; + } >>>>>>> refs/remotes/origin/3.3 // mode=1 means customers products $ajaxoptions=array(); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index b7477c203f5..ef8422a7dbc 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -230,7 +230,7 @@ class FormActions //asort($arraylist); if ($selected == 'manual') $selected='AC_OTH'; - if ($selected == 'auto') $selected='AC_OTH_AUTO'; + if ($selected == 'auto') $selected='AC_OTH_AUTO'; print $form->selectarray($htmlname, $arraylist, $selected); if ($user->admin && empty($onlyautoornot)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5d2fbf4f225..f8f2503c9a7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -383,18 +383,18 @@ class FormFile $buttonlabeltoshow=$buttonlabel; if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); - -// Keep this. Used for test with jmobile -/*print ' -
- -
-';*/ + +// Keep this. Used for test with jmobile +/*print ' +
+ +
+';*/ if (empty($noform)) $out.= '
'; $out.= ''; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index c2d3a7c32c2..f5def186abb 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -945,30 +945,30 @@ class FormOther if (! count($arrayboxtoactivatelabel)) print 'jQuery("#boxcombo").hide();'; print ' - jQuery("#left, #right").sortable({ - /* placeholder: \'ui-state-highlight\', */ - handle: \'.boxhandle\', - revert: \'invalid\', - items: \'.box\', - containment: \'.fiche\', - connectWith: \'.connectedSortable\', - stop: function(event, ui) { - updateBoxOrder(0); - } + jQuery("#left, #right").sortable({ + /* placeholder: \'ui-state-highlight\', */ + handle: \'.boxhandle\', + revert: \'invalid\', + items: \'.box\', + containment: \'.fiche\', + connectWith: \'.connectedSortable\', + stop: function(event, ui) { + updateBoxOrder(0); + } }); - jQuery(".boxclose").click(function() { - var self = this; // because JQuery can modify this + jQuery(".boxclose").click(function() { + var self = this; // because JQuery can modify this var boxid=self.id.substring(8); - var label=jQuery(\'#boxlabelentry\'+boxid).val(); + var label=jQuery(\'#boxlabelentry\'+boxid).val(); jQuery(\'#boxto_\'+boxid).remove(); if (boxid > 0) jQuery(\'#boxcombo\').append(new Option(label, boxid)); - updateBoxOrder(1); - }); + updateBoxOrder(1); + }); - });'."\n"; + });'."\n"; - print ''."\n"; + print ''."\n"; } $nbboxactivated=count($boxidactivatedforuser); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 6e302fa9806..f80bdcf79e6 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -300,7 +300,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker $sqlmodified++; } - if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG); + if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG); $result=$db->query($newsql,$usesavepoint); if ($result) @@ -1078,13 +1078,13 @@ function form_constantes($tableau,$strictw3c=0) } if ($const == 'ADHERENT_MAILMAN_LISTS') { - print '. '.$langs->trans("Example").': '.img_down().'
'; + print '. '.$langs->trans("Example").': '.img_down().'
'; print ''; - //print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; + if ($conf->categorie->enabled) print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2
'; + print '
'; + //print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; } print "\n"; diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 67b51748d3e..83d161a20a0 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -253,7 +253,7 @@ function barcode_encode_genbarcode($code,$encoding) $command=escapeshellarg($genbarcode_loc); //$paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\""; - $paramclear=" ".escapeshellarg($code)." ".escapeshellarg(strtoupper($encoding)); + $paramclear=" ".escapeshellarg($code)." ".escapeshellarg(strtoupper($encoding)); $fullcommandclear=$command." ".$paramclear." 2>&1"; //print $fullcommandclear."
\n";exit; diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index bbbce42315b..96da640962d 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -66,11 +66,11 @@ function contact_prepare_head($object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'contact'); - // Notes - $head[$h][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id; - $head[$h][1] = $langs->trans("Note"); - $head[$h][2] = 'note'; - $h++; + // Notes + $head[$h][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id; + $head[$h][1] = $langs->trans("Note"); + $head[$h][2] = 'note'; + $h++; // Info $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 1845334e6e9..b2073ff314f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1251,175 +1251,175 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re $sqlprotectagainstexternals=''; $ret=array(); - // find the subdirectory name as the reference + // find the subdirectory name as the reference if (empty($refname)) $refname=basename(dirname($original_file)."/"); // Wrapping for some images - if ($modulepart == 'companylogo') - { - $accessallowed=1; - $original_file=$conf->mycompany->dir_output.'/logos/'.$original_file; - } - // Wrapping for users photos - elseif ($modulepart == 'userphoto') - { - $accessallowed=1; - $original_file=$conf->user->dir_output.'/'.$original_file; - } - // Wrapping for members photos - elseif ($modulepart == 'memberphoto') - { - $accessallowed=1; - $original_file=$conf->adherent->dir_output.'/'.$original_file; + if ($modulepart == 'companylogo') + { + $accessallowed=1; + $original_file=$conf->mycompany->dir_output.'/logos/'.$original_file; } - // Wrapping pour les apercu factures - elseif ($modulepart == 'apercufacture') - { - if ($user->rights->facture->lire) $accessallowed=1; - $original_file=$conf->facture->dir_output.'/'.$original_file; - } - // Wrapping pour les apercu propal - elseif ($modulepart == 'apercupropal') - { - if ($user->rights->propale->lire) $accessallowed=1; - $original_file=$conf->propal->dir_output.'/'.$original_file; - } - // Wrapping pour les apercu commande - elseif ($modulepart == 'apercucommande') - { - if ($user->rights->commande->lire) $accessallowed=1; - $original_file=$conf->commande->dir_output.'/'.$original_file; - } - // Wrapping pour les apercu intervention - elseif ($modulepart == 'apercufichinter') - { - if ($user->rights->ficheinter->lire) $accessallowed=1; - $original_file=$conf->ficheinter->dir_output.'/'.$original_file; - } - // Wrapping pour les images des stats propales - elseif ($modulepart == 'propalstats') - { - if ($user->rights->propale->lire) $accessallowed=1; - $original_file=$conf->propal->dir_temp.'/'.$original_file; - } - // Wrapping pour les images des stats commandes - elseif ($modulepart == 'orderstats') - { - if ($user->rights->commande->lire) $accessallowed=1; - $original_file=$conf->commande->dir_temp.'/'.$original_file; - } - elseif ($modulepart == 'orderstatssupplier') - { - if ($user->rights->fournisseur->commande->lire) $accessallowed=1; - $original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file; - } - // Wrapping pour les images des stats factures - elseif ($modulepart == 'billstats') - { - if ($user->rights->facture->lire) $accessallowed=1; - $original_file=$conf->facture->dir_temp.'/'.$original_file; - } - elseif ($modulepart == 'billstatssupplier') - { - if ($user->rights->fournisseur->facture->lire) $accessallowed=1; - $original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file; - } - // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'expeditionstats') - { - if ($user->rights->expedition->lire) $accessallowed=1; - $original_file=$conf->expedition->dir_temp.'/'.$original_file; - } - // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'tripsexpensesstats') - { - if ($user->rights->deplacement->lire) $accessallowed=1; - $original_file=$conf->deplacement->dir_temp.'/'.$original_file; - } - // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'memberstats') - { - if ($user->rights->adherent->lire) $accessallowed=1; - $original_file=$conf->adherent->dir_temp.'/'.$original_file; - } - // Wrapping pour les images des stats produits - elseif (preg_match('/^productstats_/i',$modulepart)) - { - if ($user->rights->produit->lire || $user->rights->service->lire) $accessallowed=1; - $original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file; - } - // Wrapping for products or services - elseif ($modulepart == 'tax') - { - if ($user->rights->tax->charges->lire) $accessallowed=1; - $original_file=$conf->tax->dir_output.'/'.$original_file; - } - // Wrapping for products or services - elseif ($modulepart == 'actions') - { - if ($user->rights->agenda->myactions->read) $accessallowed=1; - $original_file=$conf->agenda->dir_output.'/'.$original_file; - } - // Wrapping for categories - elseif ($modulepart == 'category') - { - if ($user->rights->categorie->lire) $accessallowed=1; - $original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file; - } - // Wrapping pour les prelevements - elseif ($modulepart == 'prelevement') + // Wrapping for users photos + elseif ($modulepart == 'userphoto') + { + $accessallowed=1; + $original_file=$conf->user->dir_output.'/'.$original_file; + } + // Wrapping for members photos + elseif ($modulepart == 'memberphoto') + { + $accessallowed=1; + $original_file=$conf->adherent->dir_output.'/'.$original_file; + } + // Wrapping pour les apercu factures + elseif ($modulepart == 'apercufacture') + { + if ($user->rights->facture->lire) $accessallowed=1; + $original_file=$conf->facture->dir_output.'/'.$original_file; + } + // Wrapping pour les apercu propal + elseif ($modulepart == 'apercupropal') + { + if ($user->rights->propale->lire) $accessallowed=1; + $original_file=$conf->propal->dir_output.'/'.$original_file; + } + // Wrapping pour les apercu commande + elseif ($modulepart == 'apercucommande') + { + if ($user->rights->commande->lire) $accessallowed=1; + $original_file=$conf->commande->dir_output.'/'.$original_file; + } + // Wrapping pour les apercu intervention + elseif ($modulepart == 'apercufichinter') + { + if ($user->rights->ficheinter->lire) $accessallowed=1; + $original_file=$conf->ficheinter->dir_output.'/'.$original_file; + } + // Wrapping pour les images des stats propales + elseif ($modulepart == 'propalstats') + { + if ($user->rights->propale->lire) $accessallowed=1; + $original_file=$conf->propal->dir_temp.'/'.$original_file; + } + // Wrapping pour les images des stats commandes + elseif ($modulepart == 'orderstats') + { + if ($user->rights->commande->lire) $accessallowed=1; + $original_file=$conf->commande->dir_temp.'/'.$original_file; + } + elseif ($modulepart == 'orderstatssupplier') + { + if ($user->rights->fournisseur->commande->lire) $accessallowed=1; + $original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file; + } + // Wrapping pour les images des stats factures + elseif ($modulepart == 'billstats') + { + if ($user->rights->facture->lire) $accessallowed=1; + $original_file=$conf->facture->dir_temp.'/'.$original_file; + } + elseif ($modulepart == 'billstatssupplier') + { + if ($user->rights->fournisseur->facture->lire) $accessallowed=1; + $original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file; + } + // Wrapping pour les images des stats expeditions + elseif ($modulepart == 'expeditionstats') + { + if ($user->rights->expedition->lire) $accessallowed=1; + $original_file=$conf->expedition->dir_temp.'/'.$original_file; + } + // Wrapping pour les images des stats expeditions + elseif ($modulepart == 'tripsexpensesstats') + { + if ($user->rights->deplacement->lire) $accessallowed=1; + $original_file=$conf->deplacement->dir_temp.'/'.$original_file; + } + // Wrapping pour les images des stats expeditions + elseif ($modulepart == 'memberstats') + { + if ($user->rights->adherent->lire) $accessallowed=1; + $original_file=$conf->adherent->dir_temp.'/'.$original_file; + } + // Wrapping pour les images des stats produits + elseif (preg_match('/^productstats_/i',$modulepart)) + { + if ($user->rights->produit->lire || $user->rights->service->lire) $accessallowed=1; + $original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file; + } + // Wrapping for products or services + elseif ($modulepart == 'tax') + { + if ($user->rights->tax->charges->lire) $accessallowed=1; + $original_file=$conf->tax->dir_output.'/'.$original_file; + } + // Wrapping for products or services + elseif ($modulepart == 'actions') + { + if ($user->rights->agenda->myactions->read) $accessallowed=1; + $original_file=$conf->agenda->dir_output.'/'.$original_file; + } + // Wrapping for categories + elseif ($modulepart == 'category') + { + if ($user->rights->categorie->lire) $accessallowed=1; + $original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file; + } + // Wrapping pour les prelevements + elseif ($modulepart == 'prelevement') { if ($user->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) { $accessallowed=1; } - $original_file=$conf->prelevement->dir_output.'/'.$original_file; - } - // Wrapping pour les graph energie - elseif ($modulepart == 'graph_stock') - { - $accessallowed=1; - $original_file=$conf->stock->dir_temp.'/'.$original_file; - } - // Wrapping pour les graph fournisseurs - elseif ($modulepart == 'graph_fourn') - { - $accessallowed=1; - $original_file=$conf->fournisseur->dir_temp.'/'.$original_file; - } - // Wrapping pour les graph des produits - elseif ($modulepart == 'graph_product') - { - $accessallowed=1; - $original_file=$conf->product->multidir_temp[$entity].'/'.$original_file; - } - // Wrapping pour les code barre - elseif ($modulepart == 'barcode') - { - $accessallowed=1; - // If viewimage is called for barcode, we try to output an image on the fly, - // with not build of file on disk. - //$original_file=$conf->barcode->dir_temp.'/'.$original_file; - $original_file=''; - } - // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'iconmailing') - { - $accessallowed=1; - $original_file=$conf->mailing->dir_temp.'/'.$original_file; - } - // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'scanner_user_temp') - { - $accessallowed=1; - $original_file=$conf->scanner->dir_temp.'/'.$user->id.'/'.$original_file; - } - // Wrapping pour les images fckeditor - elseif ($modulepart == 'fckeditor') - { - $accessallowed=1; - $original_file=$conf->fckeditor->dir_output.'/'.$original_file; - } + $original_file=$conf->prelevement->dir_output.'/'.$original_file; + } + // Wrapping pour les graph energie + elseif ($modulepart == 'graph_stock') + { + $accessallowed=1; + $original_file=$conf->stock->dir_temp.'/'.$original_file; + } + // Wrapping pour les graph fournisseurs + elseif ($modulepart == 'graph_fourn') + { + $accessallowed=1; + $original_file=$conf->fournisseur->dir_temp.'/'.$original_file; + } + // Wrapping pour les graph des produits + elseif ($modulepart == 'graph_product') + { + $accessallowed=1; + $original_file=$conf->product->multidir_temp[$entity].'/'.$original_file; + } + // Wrapping pour les code barre + elseif ($modulepart == 'barcode') + { + $accessallowed=1; + // If viewimage is called for barcode, we try to output an image on the fly, + // with not build of file on disk. + //$original_file=$conf->barcode->dir_temp.'/'.$original_file; + $original_file=''; + } + // Wrapping pour les icones de background des mailings + elseif ($modulepart == 'iconmailing') + { + $accessallowed=1; + $original_file=$conf->mailing->dir_temp.'/'.$original_file; + } + // Wrapping pour les icones de background des mailings + elseif ($modulepart == 'scanner_user_temp') + { + $accessallowed=1; + $original_file=$conf->scanner->dir_temp.'/'.$user->id.'/'.$original_file; + } + // Wrapping pour les images fckeditor + elseif ($modulepart == 'fckeditor') + { + $accessallowed=1; + $original_file=$conf->fckeditor->dir_output.'/'.$original_file; + } // Wrapping for third parties else if ($modulepart == 'company' || $modulepart == 'societe') @@ -1711,36 +1711,36 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re else { // Define $accessallowed - if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg)) - { - if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1; - $original_file=$conf->$reg[1]->dir_temp.'/'.$user->id.'/'.$original_file; - } - else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg)) - { - if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1; - $original_file=$conf->$reg[1]->dir_temp.'/'.$original_file; - } - else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg)) - { - if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1; - $original_file=$conf->$reg[1]->dir_output.'/'.$user->id.'/'.$original_file; - } - else - { - $perm=GETPOST('perm'); - $subperm=GETPOST('subperm'); - if ($perm || $subperm) - { - if (($perm && ! $subperm && $user->rights->$modulepart->$perm) || ($perm && $subperm && $user->rights->$modulepart->$perm->$subperm)) $accessallowed=1; - $original_file=$conf->$modulepart->dir_output.'/'.$original_file; - } - else - { - if ($user->rights->$modulepart->lire || $user->rights->$modulepart->read) $accessallowed=1; - $original_file=$conf->$modulepart->dir_output.'/'.$original_file; - } - } + if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg)) + { + if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1; + $original_file=$conf->$reg[1]->dir_temp.'/'.$user->id.'/'.$original_file; + } + else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg)) + { + if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1; + $original_file=$conf->$reg[1]->dir_temp.'/'.$original_file; + } + else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg)) + { + if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1; + $original_file=$conf->$reg[1]->dir_output.'/'.$user->id.'/'.$original_file; + } + else + { + $perm=GETPOST('perm'); + $subperm=GETPOST('subperm'); + if ($perm || $subperm) + { + if (($perm && ! $subperm && $user->rights->$modulepart->$perm) || ($perm && $subperm && $user->rights->$modulepart->$perm->$subperm)) $accessallowed=1; + $original_file=$conf->$modulepart->dir_output.'/'.$original_file; + } + else + { + if ($user->rights->$modulepart->lire || $user->rights->$modulepart->read) $accessallowed=1; + $original_file=$conf->$modulepart->dir_output.'/'.$original_file; + } + } if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a specimen if ($user->admin) $accessallowed=1; // If user is admin diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 49a0fff506f..b54a370817f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -741,7 +741,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n") } } - if ($withcountry) $ret.=($object->country?$sep.$object->country:''); + if ($withcountry) $ret.=($object->country?$sep.$object->country:''); return $ret; } @@ -834,12 +834,12 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e else if ($format == 'dayxcard') $format='%Y%m%d'; else if ($format == 'dayrfc') $format='%Y-%m-%d'; // DATE_RFC3339 else if ($format == 'dayhourrfc') $format='%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 - else if ($format == 'standard') $format='%Y-%m-%d %H:%M:%S'; + else if ($format == 'standard') $format='%Y-%m-%d %H:%M:%S'; if ($reduceformat) { - $format=str_replace('%Y','%y',$format); - $format=str_replace('yyyy','yy',$format); + $format=str_replace('%Y','%y',$format); + $format=str_replace('yyyy','yy',$format); } // If date undefined or "", we return "" @@ -1230,8 +1230,8 @@ function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" { if (! empty($conf->browser->phone)) // If phone, we use link of phone { - $newphone =''; + $newphone =''; } else if (! empty($conf->clicktodial->enabled) && $addlink == 'AC_TEL') // If click to dial, we use click to dial url { @@ -2329,10 +2329,10 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field { - $options=preg_replace('/sortfield=([a-zA-Z0-9,\s\.]+)/i','',$moreparam); - $options=preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i','',$options); - $options=preg_replace('/&+/i','&',$options); - if (! preg_match('/^&/',$options)) $options='&'.$options; + $options=preg_replace('/sortfield=([a-zA-Z0-9,\s\.]+)/i','',$moreparam); + $options=preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i','',$options); + $options=preg_replace('/&+/i','&',$options); + if (! preg_match('/^&/',$options)) $options='&'.$options; if ($sortorder == 'DESC' ) $out.= ''; if ($sortorder == 'ASC' ) $out.= ''; @@ -2342,7 +2342,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field { - $out.=''; + $out.=''; } if (empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index ab41e5aaec7..1ff0fd47b0a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -745,18 +745,18 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m { $counterpadded=str_pad($counter,dol_strlen($maskcounter),"0",STR_PAD_LEFT); - // Define $maskLike - $maskLike = dol_string_nospecial($mask); - $maskLike = str_replace("%","_",$maskLike); - // Replace protected special codes with matching number of _ as wild card caracter - $maskLike = preg_replace('/\{yyyy\}/i','____',$maskLike); - $maskLike = preg_replace('/\{yy\}/i','__',$maskLike); - $maskLike = preg_replace('/\{y\}/i','_',$maskLike); - $maskLike = preg_replace('/\{mm\}/i','__',$maskLike); - $maskLike = preg_replace('/\{dd\}/i','__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike); - if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike); - if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike); + // Define $maskLike + $maskLike = dol_string_nospecial($mask); + $maskLike = str_replace("%","_",$maskLike); + // Replace protected special codes with matching number of _ as wild card caracter + $maskLike = preg_replace('/\{yyyy\}/i','____',$maskLike); + $maskLike = preg_replace('/\{yy\}/i','__',$maskLike); + $maskLike = preg_replace('/\{y\}/i','_',$maskLike); + $maskLike = preg_replace('/\{mm\}/i','__',$maskLike); + $maskLike = preg_replace('/\{dd\}/i','__',$maskLike); + $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike); + if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike); + if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike); $ref=''; $sql = "SELECT ".$field." as ref"; @@ -764,8 +764,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $sql.= " WHERE ".$field." LIKE '".$maskLike."'"; $sql.= " AND ".$field." NOT LIKE '%PROV%'"; $sql.= " AND entity IN (".getEntity($table, 1).")"; - if ($where) $sql.=$where; - if ($sqlwhere) $sql.=' AND '.$sqlwhere; + if ($where) $sql.=$where; + if ($sqlwhere) $sql.=' AND '.$sqlwhere; dol_syslog("functions2::get_next_value sql=".$sql); $resql=$db->query($sql); diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index dd9e1ba987d..6a6855b7ed9 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -238,7 +238,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte $filename='mergedpdf'; if (! empty($option)) $filename.='_'.$option; - $file=$diroutputpdf.'/'.$filename.'.pdf'; + $file=$diroutputpdf.'/'.$filename.'.pdf'; if (! $error && $pagecount) { diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index dcb94bd084a..556007967f4 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -291,9 +291,9 @@ function dol_loginfunction($langs,$conf,$mysoc) // Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_nomousehover $dol_hide_topmenu=GETPOST('dol_hide_topmenu'); $dol_hide_leftmenu=GETPOST('dol_hide_leftmenu'); - $dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen'); - $dol_no_mouse_hover=GETPOST('dol_no_mouse_hover'); - $dol_use_jmobile=GETPOST('dol_use_jmobile'); + $dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen'); + $dol_no_mouse_hover=GETPOST('dol_no_mouse_hover'); + $dol_use_jmobile=GETPOST('dol_use_jmobile'); // Include login page template include $template_dir.'login.tpl.php'; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 316c4d5b607..4d1bfad0ba3 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -76,8 +76,8 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } $url=preg_replace('/__LOGIN__/',$user->login,$url); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); - $url=preg_replace('/__USERID__/',$user->id,$url); - $shorturl=preg_replace('/__USERID__/',$user->id,$shorturl); + $url=preg_replace('/__USERID__/',$user->id,$url); + $shorturl=preg_replace('/__USERID__/',$user->id,$shorturl); // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; @@ -238,54 +238,54 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $menuArbo = new Menubase($db,'auguria'); $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu); - // We update newmenu for special dynamic menus - if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account - { - $sql = "SELECT rowid, label, courant, rappro, courant"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; - $sql.= " WHERE entity = ".$conf->entity; - $sql.= " AND clos = 0"; - $sql.= " ORDER BY label"; - - $resql = $db->query($sql); - if ($resql) - { - $numr = $db->num_rows($resql); - $i = 0; - - if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire); - - while ($i < $numr) - { - $objp = $db->fetch_object($resql); - $newmenu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); - if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate - { - $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); - } - $i++; - } - } - else dol_print_error($db); - $db->free($resql); + // We update newmenu for special dynamic menus + if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account + { + $sql = "SELECT rowid, label, courant, rappro, courant"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " AND clos = 0"; + $sql.= " ORDER BY label"; + + $resql = $db->query($sql); + if ($resql) + { + $numr = $db->num_rows($resql); + $i = 0; + + if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire); + + while ($i < $numr) + { + $objp = $db->fetch_object($resql); + $newmenu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); + if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate + { + $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); + } + $i++; + } + } + else dol_print_error($db); + $db->free($resql); } if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP { - $MAXFTP=20; - $i=1; - while ($i <= $MAXFTP) - { - $paramkey='FTP_NAME_'.$i; - //print $paramkey; - if (! empty($conf->global->$paramkey)) - { - $link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; - - $newmenu->add($link, dol_trunc($conf->global->$paramkey,24)); - } - $i++; - } + $MAXFTP=20; + $i=1; + while ($i <= $MAXFTP) + { + $paramkey='FTP_NAME_'.$i; + //print $paramkey; + if (! empty($conf->global->$paramkey)) + { + $link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; + + $newmenu->add($link, dol_trunc($conf->global->$paramkey,24)); + } + $i++; + } } @@ -334,8 +334,8 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM // Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser. $url=dol_buildpath($menu_array[$i]['url'],1); - $url=preg_replace('/__LOGIN__/',$user->login,$url); - $url=preg_replace('/__USERID__/',$user->id,$url); + $url=preg_replace('/__LOGIN__/',$user->login,$url); + $url=preg_replace('/__USERID__/',$user->id,$url); if (! preg_match('/mainmenu=/i',$menu_array[$i]['url'])) { diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 802bda1ff3d..97788a14770 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -101,7 +101,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; } - if (! empty($forceleftmenu)) $leftmenu=$forceleftmenu; + if (! empty($forceleftmenu)) $leftmenu=$forceleftmenu; require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu=array(); @@ -191,8 +191,8 @@ class MenuManager if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); - $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); - $relurl=preg_replace('/__USERID__/',$user->id,$relurl); + $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); + $relurl=preg_replace('/__USERID__/',$user->id,$relurl); print ''.$val['titre'].''."\n"; // Search submenu fot this entry @@ -201,7 +201,7 @@ class MenuManager $submenu=new Menu(); $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); $nexturl=dol_buildpath($submenu->liste[0]['url'],1); - + $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); //var_dump($canonrelurl); @@ -210,12 +210,12 @@ class MenuManager if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools'))) || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false)) { - // We add sub entry - print str_pad('',1).'
  • '; // ui-btn to highlight on clic - print ''; - print str_pad('',12,' '); - print $langs->trans(ucfirst($val['mainmenu'])."Dashboard"); - print ''; + // We add sub entry + print str_pad('',1).'
  • '; // ui-btn to highlight on clic + print ''; + print str_pad('',12,' '); + print $langs->trans(ucfirst($val['mainmenu'])."Dashboard"); + print ''; print '
  • '."\n"; } foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' @@ -226,8 +226,8 @@ class MenuManager $canonurl2=preg_replace('/\?.*$/','',$val2['url']); //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']); if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2=''; - if ($val2['level']==0) print str_pad('',$val2['level']+1).''; // ui-btn to highlight on clic - else print str_pad('',$val2['level']+1).'
  • '; // ui-btn to highlight on clic + if ($val2['level']==0) print str_pad('',$val2['level']+1).''; // ui-btn to highlight on clic + else print str_pad('',$val2['level']+1).'
  • '; // ui-btn to highlight on clic if ($relurl2) print ''; print str_pad('',($val2['level']+1)*12,' '); print $val2['titre']; diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 47e7e723682..b50ea897d83 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -77,7 +77,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; } - if (! empty($forcemainmenu)) $mainmenu=$forcemainmenu; + if (! empty($forcemainmenu)) $mainmenu=$forcemainmenu; if (isset($_GET["leftmenu"])) { @@ -98,7 +98,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; } - if (! empty($forceleftmenu)) $leftmenu=$forceleftmenu; + if (! empty($forceleftmenu)) $leftmenu=$forceleftmenu; require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu=array(); @@ -145,8 +145,8 @@ class MenuManager if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); - $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); - $relurl=preg_replace('/__USERID__/',$user->id,$relurl); + $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); + $relurl=preg_replace('/__USERID__/',$user->id,$relurl); print ''.$val['titre'].''."\n"; // Search submenu fot this entry @@ -158,7 +158,7 @@ class MenuManager $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); - //var_dump($canonrelurl); + //var_dump($canonrelurl); //var_dump($canonnexturl); print '
      '."\n"; if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools'))) diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 240953afd57..7b0beee2d11 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -89,7 +89,7 @@ class MenuManager if (empty($noout)) print_start_menu_entry_empty($idsel, $classname, $showmode); if (empty($noout)) print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&leftmenu=', $id, $idsel, $classname, $this->atarget); if (empty($noout)) print_end_menu_entry_empty($showmode); - $this->menu->add(dol_buildpath('/index.php',1), $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', ''); + $this->menu->add(dol_buildpath('/index.php',1), $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', ''); if (empty($noout)) print_end_menu_array_empty(); @@ -191,62 +191,62 @@ class MenuManager { $this->leftmenu=dol_clone($this->menu); unset($this->menu->liste); - } + } } - if ($mode == 'jmobile') - { - foreach($this->topmenu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' - { - print '
        '; - print '
      • '; - if ($val['enabled'] == 1) - { - $relurl=dol_buildpath($val['url'],1); - $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); - $relurl=preg_replace('/__USERID__/',$user->id,$relurl); - - print ''.$val['titre'].''."\n"; - // Search submenu fot this entry - $tmpmainmenu=$val['mainmenu']; - $tmpleftmenu='all'; - //$submenu=new Menu(); - //$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); - //$nexturl=dol_buildpath($submenu->liste[0]['url'],1); - $submenu=$this->leftmenu; - - $canonrelurl=preg_replace('/\?.*$/','',$relurl); - $canonnexturl=preg_replace('/\?.*$/','',$nexturl); - //var_dump($canonrelurl); - //var_dump($canonnexturl); - print '
          '; + if ($mode == 'jmobile') + { + foreach($this->topmenu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + print '
            '; + print '
          • '; + if ($val['enabled'] == 1) + { + $relurl=dol_buildpath($val['url'],1); + $relurl=preg_replace('/__LOGIN__/',$user->login,$relurl); + $relurl=preg_replace('/__USERID__/',$user->id,$relurl); + + print ''.$val['titre'].''."\n"; + // Search submenu fot this entry + $tmpmainmenu=$val['mainmenu']; + $tmpleftmenu='all'; + //$submenu=new Menu(); + //$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); + //$nexturl=dol_buildpath($submenu->liste[0]['url'],1); + $submenu=$this->leftmenu; + + $canonrelurl=preg_replace('/\?.*$/','',$relurl); + $canonnexturl=preg_replace('/\?.*$/','',$nexturl); + //var_dump($canonrelurl); + //var_dump($canonnexturl); + print '
              '; if ($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('home','tools'))) - { - // We add sub entry - print '
            • '.$langs->trans("MainArea").'-'.$val['titre'].'
            • '."\n"; - } - foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' - { - $relurl2=dol_buildpath($val2['url'],1); - $relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2); - $relurl2=preg_replace('/__USERID__/',$user->id,$relurl2); - //var_dump($val2); - print ''.$val2['titre'].''."\n"; - } - //var_dump($submenu); - print '
            '; - } - if ($val['enabled'] == 2) - { - print ''.$val['titre'].''; - } - print '
          • '; + { + // We add sub entry + print '
          • '.$langs->trans("MainArea").'-'.$val['titre'].'
          • '."\n"; + } + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + $relurl2=dol_buildpath($val2['url'],1); + $relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2); + $relurl2=preg_replace('/__USERID__/',$user->id,$relurl2); + //var_dump($val2); + print ''.$val2['titre'].''."\n"; + } + //var_dump($submenu); + print '
          '; + } + if ($val['enabled'] == 2) + { + print ''.$val['titre'].''; + } + print ''; print '
        '."\n"; - break; // Only first menu entry (so home) - } - } - + break; // Only first menu entry (so home) + } + } + unset($this->menu); return $res; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 6e30e978546..541de648360 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -608,7 +608,7 @@ abstract class DolibarrModules $file = $this->boxes[$key]['file']; //$note = $this->boxes[$key][2]; - if (empty($file)) $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; // For backward compatibility + if (empty($file)) $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; // For backward compatibility $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; $sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def"; diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 53b1e557f25..4d29682fdd3 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -297,7 +297,7 @@ class ExportCsv extends ModeleExports // Rule Dolibarr: No HTML //print $charset.' '.$newvalue."\n"; $newvalue=dol_string_nohtmltag($newvalue,1,$charset); - //print $charset.' '.$newvalue."\n"; + //print $charset.' '.$newvalue."\n"; // Rule 1 CSV: No CR, LF in cells $newvalue=str_replace("\r",'',$newvalue); diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index ea0110dfe9b..85e765c2fb3 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -425,19 +425,19 @@ class ExportExcel extends ModeleExports * @return string Letter */ function column2Letter($c) - { - - $c = intval($c); - if ($c <= 0) return ''; - + { + + $c = intval($c); + if ($c <= 0) return ''; + while ($c != 0) - { - $p = ($c - 1) % 26; - $c = intval(($c - $p) / 26); - $letter = chr(65 + $p) . $letter; - } - - return $letter; + { + $p = ($c - 1) % 26; + $c = intval(($c - $p) / 26); + $letter = chr(65 + $p) . $letter; + } + + return $letter; } } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 90a0da8b7b3..dea0334dc13 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -655,9 +655,9 @@ function tablewithentity($table) global $db; $resql=$db->DDLDescTable($table,'entity'); - if ($resql) - { - $i=0; + if ($resql) + { + $i=0; $obj=$db->fetch_object($resql); if ($obj) return 1; else return 0; diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index adf1b8689b1..5b7b385ab27 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -150,17 +150,17 @@ class pdf_typhon extends ModelePDFDeliveryOrder { $object->fetch_thirdparty(); - // Definition of $dir and $file - if ($object->specimen) - { - $dir = $conf->expedition->dir_output."/receipt"; - $file = $dir . "/SPECIMEN.pdf"; - } - else - { - $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->expedition->dir_output."/receipt/" . $objectref; - $file = $dir . "/" . $objectref . ".pdf"; + // Definition of $dir and $file + if ($object->specimen) + { + $dir = $conf->expedition->dir_output."/receipt"; + $file = $dir . "/SPECIMEN.pdf"; + } + else + { + $objectref = dol_sanitizeFileName($object->ref); + $dir = $conf->expedition->dir_output."/receipt/" . $objectref; + $file = $dir . "/" . $objectref . ".pdf"; } if (! file_exists($dir)) @@ -287,39 +287,39 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Description of product line $curX = $this->posxdesc-1; - $showpricebeforepagebreak=1; - - $pdf->startTransaction(); - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,3,$curX,$curY,$hideref,$hidedesc); - $pageposafter=$pdf->getPage(); - if ($pageposafter > $pageposbefore) // There is a pagebreak - { - $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; - //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc); - $posyafter=$pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text - { - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page - { - $pdf->AddPage('','',true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pagenb+1); - } - } - else - { - // We found a page break - $showpricebeforepagebreak=0; - } - } - else // No pagebreak - { - $pdf->commitTransaction(); - } + $showpricebeforepagebreak=1; + + $pdf->startTransaction(); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,3,$curX,$curY,$hideref,$hidedesc); + $pageposafter=$pdf->getPage(); + if ($pageposafter > $pageposbefore) // There is a pagebreak + { + $pdf->rollbackTransaction(true); + $pageposafter=$pageposbefore; + //print $pageposafter.'-'.$pageposbefore;exit; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc); + $posyafter=$pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + { + $pdf->AddPage('','',true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pagenb+1); + } + } + else + { + // We found a page break + $showpricebeforepagebreak=0; + } + } + else // No pagebreak + { + $pdf->commitTransaction(); + } $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); @@ -526,31 +526,31 @@ class pdf_typhon extends ModelePDFDeliveryOrder return 0; } - /** - * Show miscellaneous information (payment mode, payment term, ...) - * - * @param PDF &$pdf Object PDF - * @param Object $object Object to show - * @param int $posy Y - * @param Translate $outputlangs Langs object - * @return void - */ - function _tableau_info(&$pdf, $object, $posy, $outputlangs) - { - global $conf; - $default_font_size = pdf_getPDFFontSize($outputlangs); + /** + * Show miscellaneous information (payment mode, payment term, ...) + * + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void + */ + function _tableau_info(&$pdf, $object, $posy, $outputlangs) + { + global $conf; + $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetFont('','', $default_font_size); - $pdf->SetXY($this->marge_gauche, $posy); - - $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3; - $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25); - $pdf->SetXY($this->marge_gauche + 2, $posy + 2); - $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L'); - - $pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25); - $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2); - $pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L'); + $pdf->SetXY($this->marge_gauche, $posy); + + $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3; + $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25); + $pdf->SetXY($this->marge_gauche + 2, $posy + 2); + $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L'); + + $pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25); + $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2); + $pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L'); } /** @@ -629,19 +629,19 @@ class pdf_typhon extends ModelePDFDeliveryOrder pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); - // Show Draft Watermark - if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) - { - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK); + // Show Draft Watermark + if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) + { + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK); } - $pdf->SetTextColor(0,0,60); - $pdf->SetFont('','B', $default_font_size + 3); - - $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-100; - - $pdf->SetXY($this->marge_gauche,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->SetFont('','B', $default_font_size + 3); + + $posy=$this->marge_haute; + $posx=$this->page_largeur-$this->marge_droite-100; + + $pdf->SetXY($this->marge_gauche,$posy); // Logo $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; @@ -695,8 +695,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder $posy+=2; - // Show list of linked objects - $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + // Show list of linked objects + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); if ($showaddress) { @@ -724,10 +724,10 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetFont('','B',$default_font_size); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - // Show sender information - $pdf->SetXY($posx+2,$posy+8); - $pdf->SetFont('','', $default_font_size - 1); - $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); + // Show sender information + $pdf->SetXY($posx+2,$posy+8); + $pdf->SetFont('','', $default_font_size - 1); + $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); // Client destinataire $posy=42; diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index 2d4b267a8e3..f016b5d6cf6 100755 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -114,14 +114,14 @@ class modOpenSurvey extends DolibarrModules $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; - // Add here list of permission defined by an id, a label, a boolean and two constant strings. - // Example: - $this->rights[$r][0] = 55002; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/modify surveys'; // Permission label - $this->rights[$r][2] = 'w'; // Permission by default for new user (0/1) - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'survey'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + // Add here list of permission defined by an id, a label, a boolean and two constant strings. + // Example: + $this->rights[$r][0] = 55002; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/modify surveys'; // Permission label + $this->rights[$r][2] = 'w'; // Permission by default for new user (0/1) + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'survey'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; @@ -195,7 +195,7 @@ class modOpenSurvey extends DolibarrModules */ function init($options='') { - // Permissions + // Permissions $this->remove($options); $sql = array(); diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 01f1a481f86..f05a324ae84 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -107,60 +107,60 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices { global $db,$conf; - if ($object->type == 2) $prefix=$this->prefixcreditnote; - else $prefix=$this->prefixinvoice; + if ($object->type == 2) $prefix=$this->prefixcreditnote; + else $prefix=$this->prefixinvoice; - // D'abord on recupere la valeur max - $posindice=8; - $sql = "SELECT MAX(SUBSTRING(ref FROM ".$posindice.")) as max"; // This is standard SQL - $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; - $sql.= " WHERE ref LIKE '".$prefix."____-%'"; - $sql.= " AND entity = ".$conf->entity; - - $resql=$db->query($sql); - dol_syslog(get_class($this)."::getNextValue sql=".$sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - if ($obj) $max = intval($obj->max); - else $max=0; - } - else - { - dol_syslog(get_class($this)."::getNextValue sql=".$sql, LOG_ERR); - return -1; - } - - if ($mode == 'last') - { - $num = sprintf("%04s",$max); - - $ref=''; - $sql = "SELECT ref as ref"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; - $sql.= " WHERE ref LIKE '".$prefix."____-".$num."'"; - $sql.= " AND entity = ".$conf->entity; - - dol_syslog(get_class($this)."::getNextValue sql=".$sql); - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - if ($obj) $ref = $obj->ref; - } - else dol_print_error($db); - - return $ref; - } - else if ($mode == 'next') - { - $date=$object->date; // This is invoice date (not creation date) - $yymm = strftime("%y%m",$date); - $num = sprintf("%04s",$max+1); - - dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num); - return $prefix.$yymm."-".$num; - } + // D'abord on recupere la valeur max + $posindice=8; + $sql = "SELECT MAX(SUBSTRING(ref FROM ".$posindice.")) as max"; // This is standard SQL + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.= " WHERE ref LIKE '".$prefix."____-%'"; + $sql.= " AND entity = ".$conf->entity; + + $resql=$db->query($sql); + dol_syslog(get_class($this)."::getNextValue sql=".$sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) $max = intval($obj->max); + else $max=0; + } + else + { + dol_syslog(get_class($this)."::getNextValue sql=".$sql, LOG_ERR); + return -1; + } + + if ($mode == 'last') + { + $num = sprintf("%04s",$max); + + $ref=''; + $sql = "SELECT ref as ref"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.= " WHERE ref LIKE '".$prefix."____-".$num."'"; + $sql.= " AND entity = ".$conf->entity; + + dol_syslog(get_class($this)."::getNextValue sql=".$sql); + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) $ref = $obj->ref; + } + else dol_print_error($db); + + return $ref; + } + else if ($mode == 'next') + { + $date=$object->date; // This is invoice date (not creation date) + $yymm = strftime("%y%m",$date); + $num = sprintf("%04s",$max+1); + + dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num); + return $prefix.$yymm."-".$num; + } else dol_print_error('','Bad parameter for getNextValue'); } diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index a2516c160a3..0819b4fa6c2 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -49,8 +49,8 @@ $title=$langs->trans("Search"); // URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests $head=''."\n"; -$arrayofjs=array(); -$arrayofcss=array(); +$arrayofjs=array(); +$arrayofcss=array(); top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 58710d9f0e4..f0f3feec65b 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -127,8 +127,8 @@ if ($forgetpasslink || $helpcenterlink) { $moreparam=''; if ($dol_hide_topmenu) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$dol_hide_topmenu; - if ($dol_hide_leftmenu) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$dol_hide_leftmenu; - if ($dol_no_mouse_hover) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$dol_no_mouse_hover; + if ($dol_hide_leftmenu) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$dol_hide_leftmenu; + if ($dol_no_mouse_hover) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$dol_no_mouse_hover; if ($dol_use_jmobile) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$dol_use_jmobile; echo '
        '; diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 29df45e6ebc..7d78d0947da 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -19,13 +19,13 @@ header('Cache-Control: Public, must-revalidate'); header("Content-type: text/html; charset=".$conf->file->character_set_client); -if (GETPOST('dol_hide_topmenu')) $conf->dol_use_jmobile=1; -if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu=1; -if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1; -if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1; -if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1; +if (GETPOST('dol_hide_topmenu')) $conf->dol_use_jmobile=1; +if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu=1; +if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1; +if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1; +if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1; -print top_htmlhead('',$langs->trans('Login').' '.$title); +print top_htmlhead('',$langs->trans('Login').' '.$title); ?> @@ -111,11 +111,11 @@ if (! empty($hookmanager->resArray['options'])) {
        dol_hide_topmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; - if (! empty($conf->dol_hide_leftmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; - if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; - if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; + $moreparam=''; + if (! empty($conf->dol_hide_topmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; + if (! empty($conf->dol_hide_leftmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; + if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; + if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; print '('.$langs->trans('BackToLoginPage').')'; ?> diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 42b41d0ed4f..f75fcb5754b 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -119,16 +119,16 @@ print_fiche_titre($pagetitle,'','setup'); print $langs->trans('CronInfo'); -if ($action == 'delete') -{ - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1); - if ($ret == 'html') print '
        '; -} - -if ($action == 'execute'){ - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1); - if ($ret == 'html') print '
        '; -} +if ($action == 'delete') +{ + $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1); + if ($ret == 'html') print '
        '; +} + +if ($action == 'execute'){ + $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1); + if ($ret == 'html') print '
        '; +} // liste des jobs creer @@ -181,7 +181,7 @@ if (count($object->lines)>0) { print ''; print $form->selectarray('status', array('0'=>$langs->trans("No"),'1'=>$langs->trans("Yes")), GETPOST('status'), 1); print ''; - print ' '; + print ' '; print ''; print '  '; print ''; @@ -265,7 +265,7 @@ if (count($object->lines)>0) { print ''; print ''; - print yn($line->status); + print yn($line->status); print ''; print ''; diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index d37f9ad336e..c68d793185d 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -52,7 +52,7 @@ print $langs->trans("FormatedExportDesc3").'
        '; print '
        '; -print '
        '; +print '
        '; // List export set @@ -108,7 +108,7 @@ if (count($export->array_export_code)) */ } print ''; -print '
        '; +print '
        '; print '
        '; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 86eeb69febe..2f8cdc6ed22 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1,1812 +1,1812 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur -* Copyright (C) 2005-2012 Regis Houssin -* Copyright (C) 2011-2013 Juanjo Menent -* Copyright (C) 2013 Florian Henry -* -* 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 . -*/ - -/** - * \file htdocs/fichinter/fiche.php -* \brief Fichier fiche intervention -* \ingroup ficheinter -*/ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (! empty($conf->projet->enabled)) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} -if (! empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.".php")) -{ - require_once DOL_DOCUMENT_ROOT ."/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.'.php'; -} -require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - -$langs->load("companies"); -$langs->load("interventions"); - -$id = GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); -$socid = GETPOST('socid','int'); -$contratid = GETPOST('contratid','int'); -$action = GETPOST('action','alpha'); -$confirm = GETPOST('confirm','alpha'); -$mesg = GETPOST('msg','alpha'); -$origin=GETPOST('origin','alpha'); -$originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility - -//PDF -$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); -$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); -$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); - -// Security check -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); - -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('interventioncard')); - -$object = new Fichinter($db); -$extrafields = new ExtraFields($db); -$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - - -/* - * Actions -*/ - -if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $object->fetch_thirdparty(); - - $result = $object->setValid($user); - if ($result >= 0) - { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - else - { - $mesg='
        '.$object->error.'
        '; - } -} - -else if ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $object->fetch_thirdparty(); - - $result = $object->setDraft($user); - if ($result >= 0) - { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - else - { - $mesg='
        '.$object->error.'
        '; - } -} - -else if ($action == 'add' && $user->rights->ficheinter->creer) -{ - $object->socid = $socid; - $object->duree = GETPOST('duree','int'); - $object->fk_project = GETPOST('projectid','int'); - $object->fk_contrat = GETPOST('contratid','int'); - $object->author = $user->id; - $object->description = GETPOST('description'); - $object->ref = $ref; - $object->modelpdf = GETPOST('model','alpha'); - $object->note_private = GETPOST('note_private'); - $object->note_public = GETPOST('note_public'); - - if ($object->socid > 0) - { - // If creation from another object of another module (Example: origin=propal, originid=1) - if (!empty($origin) && !empty($originid) ) - { - // Parse element/subelement (ex: project_task) - $element = $subelement = $_POST['origin']; - if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs)) - { - $element = $regs[1]; - $subelement = $regs[2]; - } - - // For compatibility - if ($element == 'order') { - $element = $subelement = 'commande'; - } - if ($element == 'propal') { - $element = 'comm/propal'; $subelement = 'propal'; - } - if ($element == 'contract') { - $element = $subelement = 'contrat'; - } - - $object->origin = $origin; - $object->origin_id = $originid; - - // Possibility to add external linked objects with hooks - $object->linked_objects[$object->origin] = $object->origin_id; - if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) - { - $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); - } - - $id = $object->create($user); - - if ($id > 0) - { - dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); - - $classname = ucfirst($subelement); - $srcobject = new $classname($db); - - dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); - $result=$srcobject->fetch($object->origin_id); - if ($result > 0) - { - $srcobject->fetch_thirdparty(); - $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); - - $fk_parent_line=0; - $num=count($lines); - - for ($i=0;$i<$num;$i++) - { - $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - - if ($product_type == 1 || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products - // service prédéfini - if ($lines[$i]->fk_product > 0) - { - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $prod = new Product($db, $lines[$i]->fk_product); - - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if (empty($newlang)) $newlang=$srcobject->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; - } - else - { - $label = $lines[$i]->product_label; - } - - $desc = $label; - $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; - } - else { - $desc = dol_htmlentitiesbr($lines[$i]->desc); - $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; - } - $timearray=dol_getdate(mktime()); - $date_intervention=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); - if ($product_type == 1) - { //service - $duration = 3600; - } - else - { //product - $duration = 0; - } - - $result = $object->addline( - $user, - $id, - $desc, - $date_intervention, - $duration - ); - - if ($result < 0) - { - $error++; - break; - } - - } - } - - } - else - { - $mesg=$srcobject->error; - $error++; - } - } - else - { - $mesg=$object->error; - $error++; - } - } - else - { - $result = $object->create($user); - if ($result > 0) - { - $id=$result; // Force raffraichissement sur fiche venant d'etre cree - } - else - { - $langs->load("errors"); - $mesg='
        '.$langs->trans($object->error).'
        '; - $action = 'create'; - } - } - } - else - { - $mesg='
        '.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'
        '; - $action = 'create'; - } -} - -else if ($action == 'update' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - - $object->socid = $socid; - $object->fk_project = GETPOST('projectid','int'); - $object->fk_contrat = GETPOST('contratid','int'); - $object->author = $user->id; - $object->description = GETPOST('description','alpha'); - $object->ref = $ref; - - $result=$object->update($user); - if ($result<0) { - setEventMessage($object->error,'errors'); - } -} - -/* - * Build doc -*/ -else if ($action == 'builddoc' && $user->rights->ficheinter->creer) // En get ou en post -{ - $object->fetch($id); - $object->fetch_thirdparty(); - $object->fetch_lines(); - - if (GETPOST('model','alpha')) - { - $object->setDocModel($user, GETPOST('model','alpha')); - } - - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } -} - -// Remove file in doc form -else if ($action == 'remove_file') -{ - if ($object->fetch($id)) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - $object->fetch_thirdparty(); - - $langs->load("other"); - $upload_dir = $conf->ficheinter->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); - } -} - -// Set into a project -else if ($action == 'classin' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $result=$object->setProject(GETPOST('projectid','int')); - if ($result < 0) dol_print_error($db,$object->error); -} - -// Set into a contract -else if ($action == 'setcontrat' && $user->rights->contrat->creer) -{ - $object->fetch($id); - $result=$object->set_contrat($user,GETPOST('contratid','int')); - if ($result < 0) dol_print_error($db,$object->error); -} - -else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->ficheinter->supprimer) -{ - $object->fetch($id); - $object->fetch_thirdparty(); - $result=$object->delete($user); - if ($result<0) { - setEventMessage($object->error,'errors'); - } - - header('Location: '.DOL_URL_ROOT.'/fichinter/list.php?leftmenu=ficheinter'); - exit; -} - -else if ($action == 'setdescription' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $result=$object->set_description($user,GETPOST('description')); - if ($result < 0) dol_print_error($db,$object->error); -} -else if ($action == 'setnote_public' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); - if ($result < 0) dol_print_error($db,$object->error); -} -else if ($action == 'setnote_private' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private'); - if ($result < 0) dol_print_error($db,$object->error); -} - -// Add line -else if ($action == "addline" && $user->rights->ficheinter->creer) -{ - if (!GETPOST('np_desc')) - { - $mesg='
        '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'
        '; - $error++; - } - if (!GETPOST('durationhour','int') && !GETPOST('durationmin','int')) - { - $mesg='
        '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Duration")).'
        '; - $error++; - } - if (! $error) - { - $db->begin(); - - $ret=$object->fetch($id); - $object->fetch_thirdparty(); - - $desc=GETPOST('np_desc'); - $date_intervention = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int')); - $duration = convertTime2Seconds(GETPOST('durationhour','int'), GETPOST('durationmin','int')); - - $result=$object->addline( - $user, - $id, - $desc, - $date_intervention, - $duration - ); - - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - if ($result >= 0) - { - $db->commit(); - - fichinter_create($db, $object, $object->modelpdf, $outputlangs); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - else - { - $mesg=$object->error; - $db->rollback(); - } - } -} - -// Classify Billed -else if ($action == 'classifybilled' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $result=$object->setBilled(); - if ($result > 0) - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - else - { - $mesg='
        '.$object->error.'
        '; - } -} - -/* - * Mise a jour d'une ligne d'intervention -*/ -else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST('save','alpha') == $langs->trans("Save")) -{ - $objectline = new FichinterLigne($db); - if ($objectline->fetch(GETPOST('line_id','int')) <= 0) - { - dol_print_error($db); - exit; - } - - if ($object->fetch($objectline->fk_fichinter) <= 0) - { - dol_print_error($db); - exit; - } - $object->fetch_thirdparty(); - - $desc = GETPOST('np_desc'); - $date_inter = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int')); - $duration = convertTime2Seconds(GETPOST('durationhour','int'),GETPOST('durationmin','int')); - - $objectline->datei = $date_inter; - $objectline->desc = $desc; - $objectline->duration = $duration; - $result = $objectline->update($user); - if ($result < 0) - { - dol_print_error($db); - exit; - } - - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - fichinter_create($db, $object, $object->modelpdf, $outputlangs); - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; -} - -/* - * Supprime une ligne d'intervention AVEC confirmation -*/ -else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->ficheinter->creer) -{ - $objectline = new FichinterLigne($db); - if ($objectline->fetch(GETPOST('line_id','int')) <= 0) - { - dol_print_error($db); - exit; - } - $result=$objectline->deleteline($user); - - if ($object->fetch($objectline->fk_fichinter) <= 0) - { - dol_print_error($db); - exit; - } - - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - fichinter_create($db, $object, $object->modelpdf, $outputlangs); -} - -/* - * Ordonnancement des lignes -*/ - -else if ($action == 'up' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $object->fetch_thirdparty(); - $object->line_up(GETPOST('line_id','int')); - - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - fichinter_create($db, $object, $object->modelpdf, $outputlangs); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('line_id','int')); - exit; -} - -else if ($action == 'down' && $user->rights->ficheinter->creer) -{ - $object->fetch($id); - $object->fetch_thirdparty(); - $object->line_down(GETPOST('line_id','int')); - - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - fichinter_create($db, $object, $object->modelpdf, $outputlangs); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('line_id','int')); - exit; -} - - -/* - * Add file in email form -*/ -if (GETPOST('addfile','alpha')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; -} - -/* - * Remove file in email form -*/ -if (GETPOST('removedfile','alpha')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; -} - -/* - * Send mail -*/ -if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)) -{ - $langs->load('mails'); - - if ($object->fetch($id) > 0) - { - $object->fetch_thirdparty(); - - if (GETPOST('sendto','alpha')) - { - // Le destinataire a ete fourni via le champ libre - $sendto = GETPOST('sendto','alpha'); - $sendtoid = 0; - } - elseif (GETPOST('receiver','alpha') != '-1') - { - // Recipient was provided from combo list - if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party - { - $sendto = $object->client->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->client->contact_get_property(GETPOST('receiver'),'email'); - $sendtoid = GETPOST('receiver','alpha'); - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>'; - $replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>'; - $message = GETPOST('message'); - $sendtocc = GETPOST('sendtocc','alpha'); - $deliveryreceipt = GETPOST('deliveryreceipt','alpha'); - - if ($action == 'send') - { - if (strlen(GETPOST('subject','alphs'))) $subject = GETPOST('subject','alpha'); - else $subject = $langs->transnoentities('Intervention').' '.$object->ref; - $actiontypecode='AC_OTH_AUTO'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; - if ($message) - { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Envoi de la propal - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - $mesg='
        '.$mailfile->error.'
        '; - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); - setEventMessage($mesg); - $error=0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - - if ($error) - { - dol_print_error($db); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - $mesg='
        '; - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
        '.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - $mesg.='
        '; - } - } - } - else - { - $langs->load("other"); - $mesg='
        '.$langs->trans('ErrorMailRecipientIsEmpty').' !
        '; - dol_syslog('Recipient email is empty'); - } - } - else - { - $langs->load("other"); - $mesg='
        '.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Intervention")).'
        '; - dol_syslog('Impossible de lire les donnees de l\'intervention. Le fichier intervention n\'a peut-etre pas ete genere.'); - } - - $action='presend'; -} - -else if ($action == 'update_extras') -{ - $object->fetch($id); - // Fill array 'array_options' with data from update form - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - - // Actions on extra fields (by external module or standard code) - // FIXME le hook fait double emploi avec le trigger !! - $hookmanager->initHooks(array('interventiondao')); - $parameters=array('id'=>$object->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result=$object->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } - } - else if ($reshook < 0) $error++; -} - -if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer) -{ - if ($action == 'addcontact') - { - $result = $object->fetch($id); - - if ($result > 0 && $id > 0) - { - $contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int')); - $result = $object->add_contact($contactid, GETPOST('type','int'), GETPOST('source','alpha')); - } - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - $langs->load("errors"); - $mesg = '
        '.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
        '; - } - else - { - $mesg = '
        '.$object->error.'
        '; - } - } - } - - // bascule du statut d'un contact - else if ($action == 'swapstatut') - { - if ($object->fetch($id)) - { - $result=$object->swapContactStatus(GETPOST('ligne','int')); - } - else - { - dol_print_error($db); - } - } - - // Efface un contact - else if ($action == 'deletecontact') - { - $object->fetch($id); - $result = $object->delete_contact(GETPOST('lineid','int')); - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else { - dol_print_error($db); - } - } -} - - -/* - * View -*/ - -$form = new Form($db); -$formfile = new FormFile($db); - -llxHeader(); - -if ($action == 'create') -{ - /* - * Mode creation - * Creation d'une nouvelle fiche d'intervention - */ - - $soc=new Societe($db); - - print_fiche_titre($langs->trans("AddIntervention")); - - dol_htmloutput_mesg($mesg); - - if ($socid) $res=$soc->fetch($socid); - - if (GETPOST('origin') && GETPOST('originid')) - { - // Parse element/subelement (ex: project_task) - $element = $subelement = GETPOST('origin'); - if (preg_match('/^([^_]+)_([^_]+)/i',GETPOST('origin'),$regs)) - { - $element = $regs[1]; - $subelement = $regs[2]; - } - - if ($element == 'project') - { - $projectid=GETPOST('originid'); - } - else - { - // For compatibility - if ($element == 'order' || $element == 'commande') { - $element = $subelement = 'commande'; - } - if ($element == 'propal') { - $element = 'comm/propal'; $subelement = 'propal'; - } - if ($element == 'contract') { - $element = $subelement = 'contrat'; - } - - dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); - - $classname = ucfirst($subelement); - $objectsrc = new $classname($db); - $objectsrc->fetch(GETPOST('originid')); - if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines(); - $objectsrc->fetch_thirdparty(); - - $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); - - $soc = $objectsrc->client; - - $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); - $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); - - // Object source contacts list - $srccontactslist = $objectsrc->liste_contact(-1,'external',1); - } - } - else { - $projectid = GETPOST('projectid','int'); - $note_private = ''; - $note_public = ''; - } - - if (! $conf->global->FICHEINTER_ADDON) - { - dol_print_error($db,$langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined")); - exit; - } - - $object->date = dol_now(); - - $obj = $conf->global->FICHEINTER_ADDON; - $obj = "mod_".$obj; - - //$modFicheinter = new $obj; - //$numpr = $modFicheinter->getNextValue($soc, $object); - - if ($socid > 0) - { - $soc->fetch($socid); - - print ''; - print ''; - - print ''; - - print ''; - print ''; - - print ''; - - // Ref - print ''; - - // Description (must be a textarea and not html must be allowed (used in list view) - print ''; - print ''; - - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load("project"); - - print ''; - } - - // Contrat - if ($conf->contrat->enabled) - { - $langs->load("contrat"); - print ''; - } - - // Model - print ''; - print ''; - print '"; - - // Public note - print ''; - print ''; - print ''; - - // Private note - if (!empty($user->societe_id)) - { - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters=array('colspan' => ' colspan="2"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields,'edit'); - } - - - // Show link to origin object - if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) - { - $newclassname=$classname; - if ($newclassname=='Propal') $newclassname='CommercialProposal'; - print ''; - } - - print '
        '.$langs->trans("ThirdParty").''.$soc->getNomUrl(1).'
        '.$langs->trans('Ref').''.$langs->trans("Draft").'
        '.$langs->trans("Description").''; - print ''; - print '
        '.$langs->trans("Project").''; - /* Fix: If a project must be linked to any companies (suppliers or not), project must be not be set as limited to customer but must be not linked to any particular thirdparty - if ($societe->fournisseur==1) - $numprojet=select_projects(-1,$_POST["projectid"],'projectid'); - else - $numprojet=select_projects($societe->id,$_POST["projectid"],'projectid'); - */ - $numprojet=select_projects($soc->id,GETPOST('projectid','int'),'projectid'); - if ($numprojet==0) - { - print '   '.$langs->trans("AddProject").''; - } - print '
        '.$langs->trans("Contrat").''; - $numcontrat=select_contrats($soc->id,GETPOST('contratid','int'),'contratid'); - if ($numcontrat==0) - { - print '   '.$langs->trans("AddContract").''; - } - print '
        '.$langs->trans("DefaultModel").''; - $liste=ModelePDFFicheinter::liste_modeles($db); - print $form->selectarray('model',$liste,$conf->global->FICHEINTER_ADDON_PDF); - print "
        '.$langs->trans('NotePublic').''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); - print $doleditor->Create(1); - //print ''; - print '
        '.$langs->trans('NotePrivate').''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); - print $doleditor->Create(1); - //print ''; - print '
        '.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
        '; - - if (is_object($objectsrc)) - { - print ''; - print ''; - } - - // Model - print ''; - print ''.$langs->trans("DefaultModel").''; - print ''; - $liste=ModelePDFFicheinter::liste_modeles($db); - print $form->selectarray('model',$liste,$conf->global->FICHEINTER_ADDON_PDF); - print ""; - - // Public note - print ''; - print ''.$langs->trans('NotePublic').''; - print ''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); - print $doleditor->Create(1); - //print ''; - print ''; - - // Private note - if (!empty($user->societe_id)) - { - print ''; - print ''.$langs->trans('NotePrivate').''; - print ''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); - print $doleditor->Create(1); - //print ''; - print ''; - } - - // Other attributes - $parameters=array('colspan' => ' colspan="2"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - - - // Show link to origin object - if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) - { - $newclassname=$classname; - if ($newclassname=='Propal') $newclassname='CommercialProposal'; - print ''.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).''; - } - - print ''; - - if (is_object($objectsrc)) - { - print ''; - print ''; - } - - print '

        '; - print ''; - print '
        '; - - print ''; - } - else - { - print '
        '; - print ''; - print ''; - print '
        '.$langs->trans("ThirdParty").''; - print $form->select_company('','socid','',1,1); - print '
        '; - - print '
        '; - print ''; - print ''; - print '
        '; - - print '
        '; - } - -} -else if ($id > 0 || ! empty($ref)) -{ - /* - * Affichage en mode visu - */ - - $object->fetch($id, $ref); - $object->fetch_thirdparty(); - - $soc=new Societe($db); - $soc->fetch($object->socid); - - dol_htmloutput_mesg($mesg); - - $head = fichinter_prepare_head($object); - - dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention'); - - // Confirmation de la suppression de la fiche d'intervention - if ($action == 'delete') - { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); - if ($ret == 'html') print '
        '; - } - - // Confirmation validation - if ($action == 'validate') - { - // on verifie si l'objet est en numerotation provisoire - $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') - { - $numref = $object->getNextNumRef($soc); - if (empty($numref)) - { - $error++; - dol_htmloutput_errors($object->error); - } - } - else - { - $numref = $object->ref; - } - $text=$langs->trans('ConfirmValidateIntervention',$numref); - - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1); - if ($ret == 'html') print '
        '; - } - - // Confirmation de la validation de la fiche d'intervention - if ($action == 'modify') - { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); - if ($ret == 'html') print '
        '; - } - - // Confirmation de la suppression d'une ligne d'intervention - if ($action == 'ask_deleteline') - { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.GETPOST('line_id','int'), $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); - if ($ret == 'html') print '
        '; - } - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Third party - print ""; - - // Duration - print ''; - print ''; - print ''; - - // Description (must be a textarea and not html must be allowed (used in list view) - print ''; - print ''; - - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load('projects'); - print ''; - print ''; - print ''; - } - - // Contrat - if ($conf->contrat->enabled) - { - $langs->load('contrat'); - print ''; - print ''; - print ''; - } - - // Statut - print ''; - - // Other attributes - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - if ($action == 'edit_extras') - { - print ''; - print ''; - print ''; - print ''; - } - - foreach($extrafields->attribute_label as $key=>$label) - { - if ($action == 'edit_extras') { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - } else { - $value=$object->array_options["options_".$key]; - } - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } - } - - if(count($extrafields->attribute_label) > 0) { - - if ($action == 'edit_extras' && $user->rights->ficheinter->creer) - { - print ''; - - } - else { - if ($object->statut == 0 && $user->rights->ficheinter->creer) - { - print ''; - } - } - } - } - - print "
        '.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
        ".$langs->trans("Company")."".$object->client->getNomUrl(1)."
        '.$langs->trans("TotalDuration").''.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
        '; - print $form->editfieldkey("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea'); - print ''; - print $form->editfieldval("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea:8:80'); - print '
        '; - - print ''; - if ($action != 'classify') - { - print ''; - } - print '
        '; - print $langs->trans('Project'); - print 'id.'">'; - print img_edit($langs->trans('SetProject'),1); - print '
        '; - print '
        '; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid'); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none'); - } - print '
        '; - - print ''; - if ($action != 'contrat') - { - print ''; - } - print '
        '; - print $langs->trans('Contract'); - print 'id.'">'; - print img_edit($langs->trans('SetContrat'),1); - print '
        '; - print '
        '; - if ($action == 'contrat') - { - print '
        '; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
        '; - //print "$socid,$selected,$htmlname"; - select_contrats($object->socid,$object->fk_contrat,'contratid'); - print '
        '; - } - else - { - if ($object->fk_contrat) - { - $contratstatic = new Contrat($db); - $contratstatic->fetch($object->fk_contrat); - //print ''.$projet->title.''; - print $contratstatic->getNomUrl(0,'',1); - } - else - { - print " "; - } - } - print '
        '.$langs->trans("Status").''.$object->getLibStatut(4).'
        '; - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]); - } - if ($action == 'edit_extras' && $user->rights->ficheinter->creer) - { - print $extrafields->showInputField($key,$value); - } - else - { - print $extrafields->showOutputField($key,$value); - } - print '
        '; - print ''; - print ''; - print '
        '.img_picto('','edit').' '.$langs->trans('Modify').'

        "; - - if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) - { - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) - { - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - /* - * Lignes d'intervention - */ - $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; - $sql.= ' ft.date as date_intervention'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; - $sql.= ' WHERE ft.fk_fichinter = '.$object->id; - $sql.= ' ORDER BY ft.rang ASC, ft.rowid'; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - if ($num) - { - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - $var=true; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - - // Ligne en mode visu - if ($action != 'editline' || GETPOST('line_id','int') != $objp->rowid) - { - print ''; - print ''; - - // Duration - print ''; - - print "\n"; - - - // Icone d'edition et suppression - if ($object->statut == 0 && $user->rights->ficheinter->creer) - { - print ''; - print ''; - if ($num > 1) - { - print ''; - } - } - else - { - print ''; - } - - print ''; - } - - // Ligne en mode update - if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid) - { - print 'rowid.'" method="post">'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Date d'intervention - print ''; - - // Duration - print ''; - - print ''; - print '' . "\n"; - - print "\n"; - } - - $i++; - } - - $db->free($resql); - - /* - * Add line - */ - if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline') - { - if (! $num) print '
        '.$langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
        '; - print ''; // ancre pour retourner sur la ligne - print dol_htmlentitiesbr($objp->description); - - // Date - print ''.dol_print_date($db->jdate($objp->date_intervention),'dayhour').''.convertSecondToTime($objp->duree).''; - print 'rowid.'#'.$objp->rowid.'">'; - print img_edit(); - print ''; - print ''; - print 'rowid.'">'; - print img_delete(); - print ''; - if ($i > 0) - { - print 'rowid.'">'; - print img_up(); - print ''; - } - if ($i < $num-1) - { - print 'rowid.'">'; - print img_down(); - print ''; - } - print ' 
        '; - print ''; // ancre pour retourner sur la ligne - - // Editeur wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('np_desc',$objp->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); - $doleditor->Create(); - print ''; - $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); - print ''; - $form->select_duration('duration',$objp->duree); - print ''; - print '
        '; - - print ''; - print ''; - print ''; - print ''; - - print ''; - print "\n"; - - // Ajout ligne d'intervention - print ''; - print ''; - print ''; - print ''; - - $var=false; - - print '\n"; - print ''; - - // Date intervention - print ''; - - // Duration - print ''; - - print ''; - print ''; - - print ''; - - if (! $num) print '
        '; - print ''; // ancre - print $langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
        '; - // editeur wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('np_desc',GETPOST('np_desc','alpha'),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); - $doleditor->Create(); - print ''; - $now=dol_now(); - $timearray=dol_getdate($now); - if (!GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); - else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); - $form->select_date($timewithnohour,'di',1,1,0,"addinter"); - print ''; - $form->select_duration('duration',(!GETPOST('durationhour','int') && !GETPOST('durationmin','int'))?3600:(60*60*GETPOST('durationhour','int')+60*GETPOST('durationmin','int'))); - print '
        '; - } - - if ($num) print ''; - } - else - { - dol_print_error($db); - } - - print '
        '; - print "\n"; - - - /* - * Barre d'actions - */ - print '
        '; - - if ($user->societe_id == 0) - { - if ($action != 'editdescription' && ($action != 'presend')) - { - // Validate - if ($object->statut == 0 && $user->rights->ficheinter->creer && count($object->lines) > 0) - { - print ''; - } - - // Modify - if ($object->statut == 1 && $user->rights->ficheinter->creer) - { - print ''; - } - - // Send - if ($object->statut > 0) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) - { - print ''; - } - else print ''; - } - - // Invoicing - if (! empty($conf->facture->enabled) && $object->statut > 0) - { - $langs->load("bills"); - if ($object->statut < 2) - { - if ($user->rights->facture->creer) print ''; - else print ''; - } - - if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) - { - if ($object->statut != 2) - { - print ''; - } - } - } - - // Delete - if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) - { - print ''; - } - - } - } - - print '
        '; - print '
        '; - - if ($action != 'presend') - { - print '
        '; - //print '
        '; - - /* - * Built documents - */ - $filename=dol_sanitizeFileName($object->ref); - $filedir=$conf->ficheinter->dir_output . "/".$object->ref; - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed=$user->rights->ficheinter->creer; - $delallowed=$user->rights->ficheinter->supprimer; - $genallowed=1; - $delallowed=1; - - $var=true; - - //print "
        \n"; - $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); - - /* - * Linked object block - */ - $somethingshown=$object->showLinkedObjectBlock(); - - //print '
        '; - print '
        '; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'fichinter',$socid); - - print '
        '; - //print "
        \n"; - } - - - /* - * Action presend - */ - if ($action == 'presend') - { - $ref = dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); - $file=$fileparams['fullname']; - - // Build document if it not exists - if (! $file || ! is_readable($file)) - { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $result=fichinter_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); - $file=$fileparams['fullname']; - } - - print '
        '; - print_titre($langs->trans('SendInterventionByMail')); - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; - $formmail->withfrom=1; - $liste=array(); - foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; - $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste; - $formmail->withtocc=$liste; - $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__'); - $formmail->withfile=2; - $formmail->withbody=1; - $formmail->withdeliveryreceipt=1; - $formmail->withcancel=1; - - // Tableau des substitutions - $formmail->substit['__FICHINTERREF__']=$object->ref; - $formmail->substit['__SIGNATURE__']=$user->signature; - $formmail->substit['__PERSONALIZED__']=''; - $formmail->substit['__CONTACTCIVNAME__']=''; - - //Find the good contact adress - $custcontact=''; - $contactarr=array(); - $contactarr=$object->liste_contact(-1,'external'); - - if (is_array($contactarr) && count($contactarr)>0) { - foreach($contactarr as $contact) { - if ($contact['libelle']==$langs->trans('TypeContact_fichinter_external_CUSTOMER')) { - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - $contactstatic=new Contact($db); - $contactstatic->fetch($contact['id']); - $custcontact=$contactstatic->getFullName($langs,1); - } - } - - if (!empty($custcontact)) { - $formmail->substit['__CONTACTCIVNAME__']=$custcontact; - } - } - - // Tableau des parametres complementaires - $formmail->param['action']='send'; - $formmail->param['models']='fichinter_send'; - $formmail->param['fichinter_id']=$object->id; - $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - - // Init list of files - if (GETPOST("mode")=='init') - { - $formmail->clear_attached_files(); - $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); - } - - $formmail->show_form(); - - print '
        '; - } -} - - -llxFooter(); - -$db->close(); -?> + + * Copyright (C) 2004-2012 Laurent Destailleur +* Copyright (C) 2005-2012 Regis Houssin +* Copyright (C) 2011-2013 Juanjo Menent +* Copyright (C) 2013 Florian Henry +* +* 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 . +*/ + +/** + * \file htdocs/fichinter/fiche.php +* \brief Fichier fiche intervention +* \ingroup ficheinter +*/ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} +if (! empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.".php")) +{ + require_once DOL_DOCUMENT_ROOT ."/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.'.php'; +} +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +$langs->load("companies"); +$langs->load("interventions"); + +$id = GETPOST('id','int'); +$ref = GETPOST('ref','alpha'); +$socid = GETPOST('socid','int'); +$contratid = GETPOST('contratid','int'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); +$mesg = GETPOST('msg','alpha'); +$origin=GETPOST('origin','alpha'); +$originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility + +//PDF +$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); +$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); +$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + +// Security check +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('interventioncard')); + +$object = new Fichinter($db); +$extrafields = new ExtraFields($db); +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + + +/* + * Actions +*/ + +if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + + $result = $object->setValid($user); + if ($result >= 0) + { + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + $mesg='
        '.$object->error.'
        '; + } +} + +else if ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + + $result = $object->setDraft($user); + if ($result >= 0) + { + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + $mesg='
        '.$object->error.'
        '; + } +} + +else if ($action == 'add' && $user->rights->ficheinter->creer) +{ + $object->socid = $socid; + $object->duree = GETPOST('duree','int'); + $object->fk_project = GETPOST('projectid','int'); + $object->fk_contrat = GETPOST('contratid','int'); + $object->author = $user->id; + $object->description = GETPOST('description'); + $object->ref = $ref; + $object->modelpdf = GETPOST('model','alpha'); + $object->note_private = GETPOST('note_private'); + $object->note_public = GETPOST('note_public'); + + if ($object->socid > 0) + { + // If creation from another object of another module (Example: origin=propal, originid=1) + if (!empty($origin) && !empty($originid) ) + { + // Parse element/subelement (ex: project_task) + $element = $subelement = $_POST['origin']; + if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs)) + { + $element = $regs[1]; + $subelement = $regs[2]; + } + + // For compatibility + if ($element == 'order') { + $element = $subelement = 'commande'; + } + if ($element == 'propal') { + $element = 'comm/propal'; $subelement = 'propal'; + } + if ($element == 'contract') { + $element = $subelement = 'contrat'; + } + + $object->origin = $origin; + $object->origin_id = $originid; + + // Possibility to add external linked objects with hooks + $object->linked_objects[$object->origin] = $object->origin_id; + if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) + { + $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); + } + + $id = $object->create($user); + + if ($id > 0) + { + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); + + $classname = ucfirst($subelement); + $srcobject = new $classname($db); + + dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); + $result=$srcobject->fetch($object->origin_id); + if ($result > 0) + { + $srcobject->fetch_thirdparty(); + $lines = $srcobject->lines; + if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); + + $fk_parent_line=0; + $num=count($lines); + + for ($i=0;$i<$num;$i++) + { + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + + if ($product_type == 1 || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products + // service prédéfini + if ($lines[$i]->fk_product > 0) + { + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $prod = new Product($db, $lines[$i]->fk_product); + + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if (empty($newlang)) $newlang=$srcobject->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; + } + else + { + $label = $lines[$i]->product_label; + } + + $desc = $label; + $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; + } + else { + $desc = dol_htmlentitiesbr($lines[$i]->desc); + $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; + } + $timearray=dol_getdate(mktime()); + $date_intervention=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); + if ($product_type == 1) + { //service + $duration = 3600; + } + else + { //product + $duration = 0; + } + + $result = $object->addline( + $user, + $id, + $desc, + $date_intervention, + $duration + ); + + if ($result < 0) + { + $error++; + break; + } + + } + } + + } + else + { + $mesg=$srcobject->error; + $error++; + } + } + else + { + $mesg=$object->error; + $error++; + } + } + else + { + $result = $object->create($user); + if ($result > 0) + { + $id=$result; // Force raffraichissement sur fiche venant d'etre cree + } + else + { + $langs->load("errors"); + $mesg='
        '.$langs->trans($object->error).'
        '; + $action = 'create'; + } + } + } + else + { + $mesg='
        '.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'
        '; + $action = 'create'; + } +} + +else if ($action == 'update' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + + $object->socid = $socid; + $object->fk_project = GETPOST('projectid','int'); + $object->fk_contrat = GETPOST('contratid','int'); + $object->author = $user->id; + $object->description = GETPOST('description','alpha'); + $object->ref = $ref; + + $result=$object->update($user); + if ($result<0) { + setEventMessage($object->error,'errors'); + } +} + +/* + * Build doc +*/ +else if ($action == 'builddoc' && $user->rights->ficheinter->creer) // En get ou en post +{ + $object->fetch($id); + $object->fetch_thirdparty(); + $object->fetch_lines(); + + if (GETPOST('model','alpha')) + { + $object->setDocModel($user, GETPOST('model','alpha')); + } + + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } +} + +// Remove file in doc form +else if ($action == 'remove_file') +{ + if ($object->fetch($id)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $object->fetch_thirdparty(); + + $langs->load("other"); + $upload_dir = $conf->ficheinter->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + } +} + +// Set into a project +else if ($action == 'classin' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $result=$object->setProject(GETPOST('projectid','int')); + if ($result < 0) dol_print_error($db,$object->error); +} + +// Set into a contract +else if ($action == 'setcontrat' && $user->rights->contrat->creer) +{ + $object->fetch($id); + $result=$object->set_contrat($user,GETPOST('contratid','int')); + if ($result < 0) dol_print_error($db,$object->error); +} + +else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->ficheinter->supprimer) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + $result=$object->delete($user); + if ($result<0) { + setEventMessage($object->error,'errors'); + } + + header('Location: '.DOL_URL_ROOT.'/fichinter/list.php?leftmenu=ficheinter'); + exit; +} + +else if ($action == 'setdescription' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $result=$object->set_description($user,GETPOST('description')); + if ($result < 0) dol_print_error($db,$object->error); +} +else if ($action == 'setnote_public' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); + if ($result < 0) dol_print_error($db,$object->error); +} +else if ($action == 'setnote_private' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private'); + if ($result < 0) dol_print_error($db,$object->error); +} + +// Add line +else if ($action == "addline" && $user->rights->ficheinter->creer) +{ + if (!GETPOST('np_desc')) + { + $mesg='
        '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'
        '; + $error++; + } + if (!GETPOST('durationhour','int') && !GETPOST('durationmin','int')) + { + $mesg='
        '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Duration")).'
        '; + $error++; + } + if (! $error) + { + $db->begin(); + + $ret=$object->fetch($id); + $object->fetch_thirdparty(); + + $desc=GETPOST('np_desc'); + $date_intervention = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int')); + $duration = convertTime2Seconds(GETPOST('durationhour','int'), GETPOST('durationmin','int')); + + $result=$object->addline( + $user, + $id, + $desc, + $date_intervention, + $duration + ); + + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + if ($result >= 0) + { + $db->commit(); + + fichinter_create($db, $object, $object->modelpdf, $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + $mesg=$object->error; + $db->rollback(); + } + } +} + +// Classify Billed +else if ($action == 'classifybilled' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $result=$object->setBilled(); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + $mesg='
        '.$object->error.'
        '; + } +} + +/* + * Mise a jour d'une ligne d'intervention +*/ +else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST('save','alpha') == $langs->trans("Save")) +{ + $objectline = new FichinterLigne($db); + if ($objectline->fetch(GETPOST('line_id','int')) <= 0) + { + dol_print_error($db); + exit; + } + + if ($object->fetch($objectline->fk_fichinter) <= 0) + { + dol_print_error($db); + exit; + } + $object->fetch_thirdparty(); + + $desc = GETPOST('np_desc'); + $date_inter = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int')); + $duration = convertTime2Seconds(GETPOST('durationhour','int'),GETPOST('durationmin','int')); + + $objectline->datei = $date_inter; + $objectline->desc = $desc; + $objectline->duration = $duration; + $result = $objectline->update($user); + if ($result < 0) + { + dol_print_error($db); + exit; + } + + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + fichinter_create($db, $object, $object->modelpdf, $outputlangs); + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; +} + +/* + * Supprime une ligne d'intervention AVEC confirmation +*/ +else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->ficheinter->creer) +{ + $objectline = new FichinterLigne($db); + if ($objectline->fetch(GETPOST('line_id','int')) <= 0) + { + dol_print_error($db); + exit; + } + $result=$objectline->deleteline($user); + + if ($object->fetch($objectline->fk_fichinter) <= 0) + { + dol_print_error($db); + exit; + } + + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + fichinter_create($db, $object, $object->modelpdf, $outputlangs); +} + +/* + * Ordonnancement des lignes +*/ + +else if ($action == 'up' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + $object->line_up(GETPOST('line_id','int')); + + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + fichinter_create($db, $object, $object->modelpdf, $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('line_id','int')); + exit; +} + +else if ($action == 'down' && $user->rights->ficheinter->creer) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + $object->line_down(GETPOST('line_id','int')); + + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + fichinter_create($db, $object, $object->modelpdf, $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('line_id','int')); + exit; +} + + +/* + * Add file in email form +*/ +if (GETPOST('addfile','alpha')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory TODO Use a dedicated directory for temp mails files + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + dol_add_file_process($upload_dir_tmp,0,0); + $action='presend'; +} + +/* + * Remove file in email form +*/ +if (GETPOST('removedfile','alpha')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + // TODO Delete only files that was uploaded from email form + dol_remove_file_process(GETPOST('removedfile','alpha'),0); + $action='presend'; +} + +/* + * Send mail +*/ +if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)) +{ + $langs->load('mails'); + + if ($object->fetch($id) > 0) + { + $object->fetch_thirdparty(); + + if (GETPOST('sendto','alpha')) + { + // Le destinataire a ete fourni via le champ libre + $sendto = GETPOST('sendto','alpha'); + $sendtoid = 0; + } + elseif (GETPOST('receiver','alpha') != '-1') + { + // Recipient was provided from combo list + if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party + { + $sendto = $object->client->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $object->client->contact_get_property(GETPOST('receiver'),'email'); + $sendtoid = GETPOST('receiver','alpha'); + } + } + + if (dol_strlen($sendto)) + { + $langs->load("commercial"); + + $from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>'; + $replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>'; + $message = GETPOST('message'); + $sendtocc = GETPOST('sendtocc','alpha'); + $deliveryreceipt = GETPOST('deliveryreceipt','alpha'); + + if ($action == 'send') + { + if (strlen(GETPOST('subject','alphs'))) $subject = GETPOST('subject','alpha'); + else $subject = $langs->transnoentities('Intervention').' '.$object->ref; + $actiontypecode='AC_OTH_AUTO'; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + if ($message) + { + $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; + $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; + $actionmsg.=$message; + } + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); + } + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $attachedfiles=$formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + // Envoi de la propal + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); + if ($mailfile->error) + { + $mesg='
        '.$mailfile->error.'
        '; + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); + setEventMessage($mesg); + $error=0; + + // Initialisation donnees + $object->sendtoid = $sendtoid; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; + $object->actionmsg2 = $actionmsg2; + $object->fk_element = $object->id; + $object->elementtype = $object->element; + + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$object,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + + if ($error) + { + dol_print_error($db); + } + else + { + // Redirect here + // This avoid sending mail twice if going out and then back to page + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + } + else + { + $langs->load("other"); + $mesg='
        '; + if ($mailfile->error) + { + $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.='
        '.$mailfile->error; + } + else + { + $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; + } + $mesg.='
        '; + } + } + } + else + { + $langs->load("other"); + $mesg='
        '.$langs->trans('ErrorMailRecipientIsEmpty').' !
        '; + dol_syslog('Recipient email is empty'); + } + } + else + { + $langs->load("other"); + $mesg='
        '.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Intervention")).'
        '; + dol_syslog('Impossible de lire les donnees de l\'intervention. Le fichier intervention n\'a peut-etre pas ete genere.'); + } + + $action='presend'; +} + +else if ($action == 'update_extras') +{ + $object->fetch($id); + // Fill array 'array_options' with data from update form + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('interventiondao')); + $parameters=array('id'=>$object->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$object->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; +} + +if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer) +{ + if ($action == 'addcontact') + { + $result = $object->fetch($id); + + if ($result > 0 && $id > 0) + { + $contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int')); + $result = $object->add_contact($contactid, GETPOST('type','int'), GETPOST('source','alpha')); + } + + if ($result >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $langs->load("errors"); + $mesg = '
        '.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
        '; + } + else + { + $mesg = '
        '.$object->error.'
        '; + } + } + } + + // bascule du statut d'un contact + else if ($action == 'swapstatut') + { + if ($object->fetch($id)) + { + $result=$object->swapContactStatus(GETPOST('ligne','int')); + } + else + { + dol_print_error($db); + } + } + + // Efface un contact + else if ($action == 'deletecontact') + { + $object->fetch($id); + $result = $object->delete_contact(GETPOST('lineid','int')); + + if ($result >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else { + dol_print_error($db); + } + } +} + + +/* + * View +*/ + +$form = new Form($db); +$formfile = new FormFile($db); + +llxHeader(); + +if ($action == 'create') +{ + /* + * Mode creation + * Creation d'une nouvelle fiche d'intervention + */ + + $soc=new Societe($db); + + print_fiche_titre($langs->trans("AddIntervention")); + + dol_htmloutput_mesg($mesg); + + if ($socid) $res=$soc->fetch($socid); + + if (GETPOST('origin') && GETPOST('originid')) + { + // Parse element/subelement (ex: project_task) + $element = $subelement = GETPOST('origin'); + if (preg_match('/^([^_]+)_([^_]+)/i',GETPOST('origin'),$regs)) + { + $element = $regs[1]; + $subelement = $regs[2]; + } + + if ($element == 'project') + { + $projectid=GETPOST('originid'); + } + else + { + // For compatibility + if ($element == 'order' || $element == 'commande') { + $element = $subelement = 'commande'; + } + if ($element == 'propal') { + $element = 'comm/propal'; $subelement = 'propal'; + } + if ($element == 'contract') { + $element = $subelement = 'contrat'; + } + + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); + + $classname = ucfirst($subelement); + $objectsrc = new $classname($db); + $objectsrc->fetch(GETPOST('originid')); + if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines(); + $objectsrc->fetch_thirdparty(); + + $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); + + $soc = $objectsrc->client; + + $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); + $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); + + // Object source contacts list + $srccontactslist = $objectsrc->liste_contact(-1,'external',1); + } + } + else { + $projectid = GETPOST('projectid','int'); + $note_private = ''; + $note_public = ''; + } + + if (! $conf->global->FICHEINTER_ADDON) + { + dol_print_error($db,$langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined")); + exit; + } + + $object->date = dol_now(); + + $obj = $conf->global->FICHEINTER_ADDON; + $obj = "mod_".$obj; + + //$modFicheinter = new $obj; + //$numpr = $modFicheinter->getNextValue($soc, $object); + + if ($socid > 0) + { + $soc->fetch($socid); + + print '
        '; + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + // Ref + print ''; + + // Description (must be a textarea and not html must be allowed (used in list view) + print ''; + print ''; + + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("project"); + + print ''; + } + + // Contrat + if ($conf->contrat->enabled) + { + $langs->load("contrat"); + print ''; + } + + // Model + print ''; + print ''; + print '"; + + // Public note + print ''; + print ''; + print ''; + + // Private note + if (!empty($user->societe_id)) + { + print ''; + print ''; + print ''; + } + + // Other attributes + $parameters=array('colspan' => ' colspan="2"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } + + + // Show link to origin object + if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) + { + $newclassname=$classname; + if ($newclassname=='Propal') $newclassname='CommercialProposal'; + print ''; + } + + print '
        '.$langs->trans("ThirdParty").''.$soc->getNomUrl(1).'
        '.$langs->trans('Ref').''.$langs->trans("Draft").'
        '.$langs->trans("Description").''; + print ''; + print '
        '.$langs->trans("Project").''; + /* Fix: If a project must be linked to any companies (suppliers or not), project must be not be set as limited to customer but must be not linked to any particular thirdparty + if ($societe->fournisseur==1) + $numprojet=select_projects(-1,$_POST["projectid"],'projectid'); + else + $numprojet=select_projects($societe->id,$_POST["projectid"],'projectid'); + */ + $numprojet=select_projects($soc->id,GETPOST('projectid','int'),'projectid'); + if ($numprojet==0) + { + print '   '.$langs->trans("AddProject").''; + } + print '
        '.$langs->trans("Contrat").''; + $numcontrat=select_contrats($soc->id,GETPOST('contratid','int'),'contratid'); + if ($numcontrat==0) + { + print '   '.$langs->trans("AddContract").''; + } + print '
        '.$langs->trans("DefaultModel").''; + $liste=ModelePDFFicheinter::liste_modeles($db); + print $form->selectarray('model',$liste,$conf->global->FICHEINTER_ADDON_PDF); + print "
        '.$langs->trans('NotePublic').''; + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print ''; + print '
        '.$langs->trans('NotePrivate').''; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print ''; + print '
        '.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
        '; + + if (is_object($objectsrc)) + { + print ''; + print ''; + } + + // Model + print ''; + print ''.$langs->trans("DefaultModel").''; + print ''; + $liste=ModelePDFFicheinter::liste_modeles($db); + print $form->selectarray('model',$liste,$conf->global->FICHEINTER_ADDON_PDF); + print ""; + + // Public note + print ''; + print ''.$langs->trans('NotePublic').''; + print ''; + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print ''; + print ''; + + // Private note + if (!empty($user->societe_id)) + { + print ''; + print ''.$langs->trans('NotePrivate').''; + print ''; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print ''; + print ''; + } + + // Other attributes + $parameters=array('colspan' => ' colspan="2"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + + + // Show link to origin object + if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) + { + $newclassname=$classname; + if ($newclassname=='Propal') $newclassname='CommercialProposal'; + print ''.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).''; + } + + print ''; + + if (is_object($objectsrc)) + { + print ''; + print ''; + } + + print '

        '; + print ''; + print '
        '; + + print '
        '; + } + else + { + print '
        '; + print ''; + print ''; + print '
        '.$langs->trans("ThirdParty").''; + print $form->select_company('','socid','',1,1); + print '
        '; + + print '
        '; + print ''; + print ''; + print '
        '; + + print '
        '; + } + +} +else if ($id > 0 || ! empty($ref)) +{ + /* + * Affichage en mode visu + */ + + $object->fetch($id, $ref); + $object->fetch_thirdparty(); + + $soc=new Societe($db); + $soc->fetch($object->socid); + + dol_htmloutput_mesg($mesg); + + $head = fichinter_prepare_head($object); + + dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention'); + + // Confirmation de la suppression de la fiche d'intervention + if ($action == 'delete') + { + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); + if ($ret == 'html') print '
        '; + } + + // Confirmation validation + if ($action == 'validate') + { + // on verifie si l'objet est en numerotation provisoire + $ref = substr($object->ref, 1, 4); + if ($ref == 'PROV') + { + $numref = $object->getNextNumRef($soc); + if (empty($numref)) + { + $error++; + dol_htmloutput_errors($object->error); + } + } + else + { + $numref = $object->ref; + } + $text=$langs->trans('ConfirmValidateIntervention',$numref); + + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1); + if ($ret == 'html') print '
        '; + } + + // Confirmation de la validation de la fiche d'intervention + if ($action == 'modify') + { + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); + if ($ret == 'html') print '
        '; + } + + // Confirmation de la suppression d'une ligne d'intervention + if ($action == 'ask_deleteline') + { + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.GETPOST('line_id','int'), $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); + if ($ret == 'html') print '
        '; + } + + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Third party + print ""; + + // Duration + print ''; + print ''; + print ''; + + // Description (must be a textarea and not html must be allowed (used in list view) + print ''; + print ''; + + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load('projects'); + print ''; + print ''; + print ''; + } + + // Contrat + if ($conf->contrat->enabled) + { + $langs->load('contrat'); + print ''; + print ''; + print ''; + } + + // Statut + print ''; + + // Other attributes + $parameters=array('colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + if ($action == 'edit_extras') + { + print ''; + print ''; + print ''; + print ''; + } + + foreach($extrafields->attribute_label as $key=>$label) + { + if ($action == 'edit_extras') { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + } else { + $value=$object->array_options["options_".$key]; + } + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''."\n"; + } + } + + if(count($extrafields->attribute_label) > 0) { + + if ($action == 'edit_extras' && $user->rights->ficheinter->creer) + { + print ''; + + } + else { + if ($object->statut == 0 && $user->rights->ficheinter->creer) + { + print ''; + } + } + } + } + + print "
        '.$langs->trans("Ref").''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); + print '
        ".$langs->trans("Company")."".$object->client->getNomUrl(1)."
        '.$langs->trans("TotalDuration").''.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
        '; + print $form->editfieldkey("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea'); + print ''; + print $form->editfieldval("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea:8:80'); + print '
        '; + + print ''; + if ($action != 'classify') + { + print ''; + } + print '
        '; + print $langs->trans('Project'); + print 'id.'">'; + print img_edit($langs->trans('SetProject'),1); + print '
        '; + print '
        '; + if ($action == 'classify') + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid'); + } + else + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none'); + } + print '
        '; + + print ''; + if ($action != 'contrat') + { + print ''; + } + print '
        '; + print $langs->trans('Contract'); + print 'id.'">'; + print img_edit($langs->trans('SetContrat'),1); + print '
        '; + print '
        '; + if ($action == 'contrat') + { + print '
        '; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
        '; + //print "$socid,$selected,$htmlname"; + select_contrats($object->socid,$object->fk_contrat,'contratid'); + print '
        '; + } + else + { + if ($object->fk_contrat) + { + $contratstatic = new Contrat($db); + $contratstatic->fetch($object->fk_contrat); + //print ''.$projet->title.''; + print $contratstatic->getNomUrl(0,'',1); + } + else + { + print " "; + } + } + print '
        '.$langs->trans("Status").''.$object->getLibStatut(4).'
        '; + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]); + } + if ($action == 'edit_extras' && $user->rights->ficheinter->creer) + { + print $extrafields->showInputField($key,$value); + } + else + { + print $extrafields->showOutputField($key,$value); + } + print '
        '; + print ''; + print ''; + print '
        '.img_picto('','edit').' '.$langs->trans('Modify').'

        "; + + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + { + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + /* + * Lignes d'intervention + */ + $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; + $sql.= ' ft.date as date_intervention'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; + $sql.= ' WHERE ft.fk_fichinter = '.$object->id; + $sql.= ' ORDER BY ft.rang ASC, ft.rowid'; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + if ($num) + { + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + $var=true; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + + // Ligne en mode visu + if ($action != 'editline' || GETPOST('line_id','int') != $objp->rowid) + { + print ''; + print ''; + + // Duration + print ''; + + print "\n"; + + + // Icone d'edition et suppression + if ($object->statut == 0 && $user->rights->ficheinter->creer) + { + print ''; + print ''; + if ($num > 1) + { + print ''; + } + } + else + { + print ''; + } + + print ''; + } + + // Ligne en mode update + if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid) + { + print 'rowid.'" method="post">'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + // Date d'intervention + print ''; + + // Duration + print ''; + + print ''; + print '' . "\n"; + + print "\n"; + } + + $i++; + } + + $db->free($resql); + + /* + * Add line + */ + if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline') + { + if (! $num) print '
        '.$langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
        '; + print ''; // ancre pour retourner sur la ligne + print dol_htmlentitiesbr($objp->description); + + // Date + print ''.dol_print_date($db->jdate($objp->date_intervention),'dayhour').''.convertSecondToTime($objp->duree).''; + print 'rowid.'#'.$objp->rowid.'">'; + print img_edit(); + print ''; + print ''; + print 'rowid.'">'; + print img_delete(); + print ''; + if ($i > 0) + { + print 'rowid.'">'; + print img_up(); + print ''; + } + if ($i < $num-1) + { + print 'rowid.'">'; + print img_down(); + print ''; + } + print ' 
        '; + print ''; // ancre pour retourner sur la ligne + + // Editeur wysiwyg + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('np_desc',$objp->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); + $doleditor->Create(); + print ''; + $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); + print ''; + $form->select_duration('duration',$objp->duree); + print ''; + print '
        '; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print "\n"; + + // Ajout ligne d'intervention + print ''; + print ''; + print ''; + print ''; + + $var=false; + + print '\n"; + print ''; + + // Date intervention + print ''; + + // Duration + print ''; + + print ''; + print ''; + + print ''; + + if (! $num) print '
        '; + print ''; // ancre + print $langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
        '; + // editeur wysiwyg + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('np_desc',GETPOST('np_desc','alpha'),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); + $doleditor->Create(); + print ''; + $now=dol_now(); + $timearray=dol_getdate($now); + if (!GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); + else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); + $form->select_date($timewithnohour,'di',1,1,0,"addinter"); + print ''; + $form->select_duration('duration',(!GETPOST('durationhour','int') && !GETPOST('durationmin','int'))?3600:(60*60*GETPOST('durationhour','int')+60*GETPOST('durationmin','int'))); + print '
        '; + } + + if ($num) print ''; + } + else + { + dol_print_error($db); + } + + print '
        '; + print "\n"; + + + /* + * Barre d'actions + */ + print '
        '; + + if ($user->societe_id == 0) + { + if ($action != 'editdescription' && ($action != 'presend')) + { + // Validate + if ($object->statut == 0 && $user->rights->ficheinter->creer && count($object->lines) > 0) + { + print ''; + } + + // Modify + if ($object->statut == 1 && $user->rights->ficheinter->creer) + { + print ''; + } + + // Send + if ($object->statut > 0) + { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) + { + print ''; + } + else print ''; + } + + // Invoicing + if (! empty($conf->facture->enabled) && $object->statut > 0) + { + $langs->load("bills"); + if ($object->statut < 2) + { + if ($user->rights->facture->creer) print ''; + else print ''; + } + + if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) + { + if ($object->statut != 2) + { + print ''; + } + } + } + + // Delete + if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) + { + print ''; + } + + } + } + + print '
        '; + print '
        '; + + if ($action != 'presend') + { + print '
        '; + //print '
        '; + + /* + * Built documents + */ + $filename=dol_sanitizeFileName($object->ref); + $filedir=$conf->ficheinter->dir_output . "/".$object->ref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed=$user->rights->ficheinter->creer; + $delallowed=$user->rights->ficheinter->supprimer; + $genallowed=1; + $delallowed=1; + + $var=true; + + //print "
        \n"; + $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); + + /* + * Linked object block + */ + $somethingshown=$object->showLinkedObjectBlock(); + + //print '
        '; + print '
        '; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'fichinter',$socid); + + print '
        '; + //print "
        \n"; + } + + + /* + * Action presend + */ + if ($action == 'presend') + { + $ref = dol_sanitizeFileName($object->ref); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); + $file=$fileparams['fullname']; + + // Build document if it not exists + if (! $file || ! is_readable($file)) + { + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $result=fichinter_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); + $file=$fileparams['fullname']; + } + + print '
        '; + print_titre($langs->trans('SendInterventionByMail')); + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; + $formmail->fromname = $user->getFullName($langs); + $formmail->frommail = $user->email; + $formmail->withfrom=1; + $liste=array(); + foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; + $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste; + $formmail->withtocc=$liste; + $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; + $formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__'); + $formmail->withfile=2; + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + + // Tableau des substitutions + $formmail->substit['__FICHINTERREF__']=$object->ref; + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__PERSONALIZED__']=''; + $formmail->substit['__CONTACTCIVNAME__']=''; + + //Find the good contact adress + $custcontact=''; + $contactarr=array(); + $contactarr=$object->liste_contact(-1,'external'); + + if (is_array($contactarr) && count($contactarr)>0) { + foreach($contactarr as $contact) { + if ($contact['libelle']==$langs->trans('TypeContact_fichinter_external_CUSTOMER')) { + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + $contactstatic=new Contact($db); + $contactstatic->fetch($contact['id']); + $custcontact=$contactstatic->getFullName($langs,1); + } + } + + if (!empty($custcontact)) { + $formmail->substit['__CONTACTCIVNAME__']=$custcontact; + } + } + + // Tableau des parametres complementaires + $formmail->param['action']='send'; + $formmail->param['models']='fichinter_send'; + $formmail->param['fichinter_id']=$object->id; + $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + + // Init list of files + if (GETPOST("mode")=='init') + { + $formmail->clear_attached_files(); + $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); + } + + $formmail->show_form(); + + print '
        '; + } +} + + +llxFooter(); + +$db->close(); +?> diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index e3bc1fadb8b..19912e3f58f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -855,42 +855,42 @@ class FactureFournisseur extends CommonInvoice } } - if (! $error) - { - $this->oldref = ''; - - // Rename directory if dir was a temporary ref - if (preg_match('/^[\(]?PROV/i', $this->ref)) - { - // On renomme repertoire facture ($this->ref = ancienne ref, $num = nouvelle ref) - // afin de ne pas perdre les fichiers attaches - $facref = dol_sanitizeFileName($this->ref); + if (! $error) + { + $this->oldref = ''; + + // Rename directory if dir was a temporary ref + if (preg_match('/^[\(]?PROV/i', $this->ref)) + { + // On renomme repertoire facture ($this->ref = ancienne ref, $num = nouvelle ref) + // afin de ne pas perdre les fichiers attaches + $facref = dol_sanitizeFileName($this->ref); $snumfa = dol_sanitizeFileName($num); - $dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$facref; + $dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$facref; $dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$snumfa; - if (file_exists($dirsource)) - { - dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); - - if (@rename($dirsource, $dirdest)) - { - $this->oldref = $facref; - - dol_syslog("Rename ok"); - // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$snumfa.'/'.$facref.'*.*'); - } - } - } + if (file_exists($dirsource)) + { + dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); + + if (@rename($dirsource, $dirdest)) + { + $this->oldref = $facref; + + dol_syslog("Rename ok"); + // Suppression ancien fichier PDF dans nouveau rep + dol_delete_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$snumfa.'/'.$facref.'*.*'); + } + } + } } - // Set new ref and define current statut - if (! $error) - { - $this->ref = $num; - $this->statut=1; - //$this->date_validation=$now; this is stored into log table + // Set new ref and define current statut + if (! $error) + { + $this->ref = $num; + $this->statut=1; + //$this->date_validation=$now; this is stored into log table } // Triggers call diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index aa9658a9d84..c2dc17f798f 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -114,14 +114,14 @@ elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourni $object->fetch($id); $object->fetch_thirdparty(); - $qualified_for_stock_change=0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - $qualified_for_stock_change=$object->hasProductsOrServices(2); - } - else - { - $qualified_for_stock_change=$object->hasProductsOrServices(1); + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); } // Check parameters diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 38ce1e648b3..1af03e83a01 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -219,7 +219,7 @@ if ($object->fetch($id)) print ''; - print '
        '; + print '
        '; //print ''; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 65ec397e242..f2681a936f7 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1314,11 +1314,11 @@ if ($step == 5 && $datatoimport) $sourcelinenb++; // Read line and stor it into $arrayrecord $arrayrecord=$obj->import_read_record(); - if ($arrayrecord === false) - { + if ($arrayrecord === false) + { $arrayofwarnings[$sourcelinenb][0]=array('lib'=>'File has '.$nboflines.' lines. However we reach end of file after record '.$sourcelinenb.'. This may occurs when some records are split onto several lines.','type'=>'EOF_RECORD_ON_SEVERAL_LINES'); - $endoffile++; - continue; + $endoffile++; + continue; } if ($excludefirstline && $sourcelinenb == 1) continue; diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index ac9e9d645fa..19642c63378 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -98,7 +98,7 @@ if (count($import->array_import_code)) //} } print ''; -print '
        '; +print '
        '; print '
        '; @@ -137,5 +137,5 @@ print '
        '; llxFooter(); -$db->close(); +$db->close(); ?> diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index e477ec3b6a5..280d9c5b746 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -335,11 +335,11 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) $beforeversionarray=explode('.','3.4.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) { - // Reload modules (this must be always and only into last targeted version) - migrate_reload_modules($db,$langs,$conf); - - // Reload menus (this must be always and only into last targeted version) - migrate_reload_menu($db,$langs,$conf,$versionto); + // Reload modules (this must be always and only into last targeted version) + migrate_reload_modules($db,$langs,$conf); + + // Reload menus (this must be always and only into last targeted version) + migrate_reload_menu($db,$langs,$conf,$versionto); } print '
        '.$langs->trans("MigrationFinished").''; @@ -3526,9 +3526,9 @@ function migrate_delete_old_files($db,$langs,$conf) DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone.lib.php', DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_backoffice.php', DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_frontoffice.php', - DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_backoffice.php', - DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_frontoffice.php', - DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_backoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_backoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_frontoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_backoffice.php', DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_frontoffice.php', DOL_DOCUMENT_ROOT.'/core/modules/mailings/dolibarr_services_expired.modules.php', DOL_DOCUMENT_ROOT.'/core/modules/mailings/peche.modules.php', diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index 26c9cb3a24b..6d576ee2067 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -42,8 +42,8 @@ class MailmanSpip var $mladded_ok; var $mladded_ko; - var $mlremoved_ok; - var $mlremoved_ko; + var $mlremoved_ok; + var $mlremoved_ko; /** diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 48169cdfd31..af53c2460e3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -345,17 +345,17 @@ if (! defined('NOLOGIN')) // It is not already authenticated and it requests the login / password include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $dol_dst_observed=GETPOST("dst_observed",3); - $dol_dst_first=GETPOST("dst_first",3); - $dol_dst_second=GETPOST("dst_second",3); - $dol_screenwidth=GETPOST("screenwidth",3); - $dol_screenheight=GETPOST("screenheight",3); - $dol_hide_topmenu=GETPOST('dol_hide_topmenu',3); - $dol_hide_leftmenu=GETPOST('dol_hide_leftmenu',3); - $dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen',3); - $dol_no_mouse_hover=GETPOST('dol_no_mouse_hover',3); - $dol_use_jmobile=GETPOST('dol_use_jmobile',3); - //dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,',')); + $dol_dst_observed=GETPOST("dst_observed",3); + $dol_dst_first=GETPOST("dst_first",3); + $dol_dst_second=GETPOST("dst_second",3); + $dol_screenwidth=GETPOST("screenwidth",3); + $dol_screenheight=GETPOST("screenheight",3); + $dol_hide_topmenu=GETPOST('dol_hide_topmenu',3); + $dol_hide_leftmenu=GETPOST('dol_hide_leftmenu',3); + $dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen',3); + $dol_no_mouse_hover=GETPOST('dol_no_mouse_hover',3); + $dol_use_jmobile=GETPOST('dol_use_jmobile',3); + //dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,',')); // If in demo mode, we check we go to home page through the public/demo/index.php page if (! empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_URL_ROOT.'/index.php') // We ask index page @@ -589,7 +589,7 @@ if (! defined('NOLOGIN')) if (! empty($dol_hide_leftmenu)) $_SESSION['dol_hide_leftmenu']=$dol_hide_leftmenu; if (! empty($dol_optimize_smallscreen)) $_SESSION['dol_optimize_smallscreen']=$dol_optimize_smallscreen; if (! empty($dol_no_mouse_hover)) $_SESSION['dol_no_mouse_hover']=$dol_no_mouse_hover; - if (! empty($dol_use_jmobile)) $_SESSION['dol_use_jmobile']=$dol_use_jmobile; + if (! empty($dol_use_jmobile)) $_SESSION['dol_use_jmobile']=$dol_use_jmobile; dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"]." Session id=".session_id()); @@ -680,15 +680,15 @@ if (GETPOST('theme')) $conf->css = "/theme/".$conf->theme."/style.css.php"; } -// Set javascript option -if (! GETPOST('nojs')) // If javascript was not disabled on URL -{ - if (! empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) - { - $conf->use_javascript_ajax=! $user->conf->MAIN_DISABLE_JAVASCRIPT; - } -} -else $conf->use_javascript_ajax=0; +// Set javascript option +if (! GETPOST('nojs')) // If javascript was not disabled on URL +{ + if (! empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) + { + $conf->use_javascript_ajax=! $user->conf->MAIN_DISABLE_JAVASCRIPT; + } +} +else $conf->use_javascript_ajax=0; // Set terminal output option if (GETPOST('dol_hide_leftmenu') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1; @@ -937,9 +937,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); print ''."\n"; - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; // Displays title $appli='Dolibarr'; @@ -980,9 +980,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs { print ''."\n"; } - // jQuery jMobile - if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile)) - { + // jQuery jMobile + if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile)) + { print ''."\n"; } @@ -1145,30 +1145,30 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; print ''."\n"; } - // jQuery jMobile - if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0)) + // jQuery jMobile + if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0)) { // Note: We can force not using ajax because cache of jquery does not load js of other pages by setting ajaxEnabled. if (empty($conf->dol_use_jmobile) || $conf->dol_use_jmobile != 2) { - print ''; } - print ''."\n"; - } + print ''."\n"; + } } - if (! $disablejs && ! empty($conf->use_javascript_ajax)) + if (! $disablejs && ! empty($conf->use_javascript_ajax)) { // CKEditor if (! empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor')) @@ -1579,19 +1579,19 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print "\n"; } - //Dolibarr version - $doliurl='http://www.dolibarr.org'; - $appli='Dolibarr'; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli=$conf->global->MAIN_APPLICATION_TITLE; $doliurl=''; - } - $appli.=" ".DOL_VERSION; - print '
        '; - if ($doliurl) print ''; - print $appli; - if ($doliurl) print ''; - print '
        '; - + //Dolibarr version + $doliurl='http://www.dolibarr.org'; + $appli='Dolibarr'; + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { + $appli=$conf->global->MAIN_APPLICATION_TITLE; $doliurl=''; + } + $appli.=" ".DOL_VERSION; + print '
        '; + if ($doliurl) print ''; + print $appli; + if ($doliurl) print ''; + print '
        '; + // Link to Dolibarr wiki pages if ($helppagename && empty($conf->global->MAIN_HELP_DISABLELINK)) { diff --git a/htdocs/opensurvey/admin/index.php b/htdocs/opensurvey/admin/index.php index 6ab9c74dc24..d22c3f03cde 100755 --- a/htdocs/opensurvey/admin/index.php +++ b/htdocs/opensurvey/admin/index.php @@ -22,14 +22,14 @@ */ require_once('../../main.inc.php'); -require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); - -// Security check +require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); + +// Security check if (!$user->admin) accessforbidden(); -$langs->load("admin"); +$langs->load("admin"); $langs->load("other"); @@ -39,7 +39,7 @@ $langs->load("other"); $langs->load("opensurvey"); -llxHeader(); +llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("OpenSurveyArea"),$linkback,'setup'); @@ -47,16 +47,16 @@ print '
        '; echo $langs->trans("OpenSurveyNothingToSetup").'

        '."\n"; -// Link -print img_picto('','object_globe.png').' '.$langs->trans("PublicLinkToCreateSurvey").':
        '; - -// Define $urlwithroot -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - -$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/index.php',1); -$urllink=''.$url.''; +// Link +print img_picto('','object_globe.png').' '.$langs->trans("PublicLinkToCreateSurvey").':
        '; + +// Define $urlwithroot +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + +$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/index.php',1); +$urllink=''.$url.''; print $urllink; diff --git a/htdocs/opensurvey/adminstuds.php b/htdocs/opensurvey/adminstuds.php index d3547a4ac51..39d804ee578 100755 --- a/htdocs/opensurvey/adminstuds.php +++ b/htdocs/opensurvey/adminstuds.php @@ -15,17 +15,17 @@ * along with this program. If not, see . */ -/** - * \file htdocs/opensurvey/adminstuds.php - * \ingroup opensurvey - * \brief Page to edit survey +/** + * \file htdocs/opensurvey/adminstuds.php + * \ingroup opensurvey + * \brief Page to edit survey */ require_once('../main.inc.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"); -require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); +require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); // Security check @@ -44,14 +44,14 @@ if (GETPOST('sondage')) } else { - $numsondageadmin=''; - $numsondage=GETPOST("sondage",'alpha'); + $numsondageadmin=''; + $numsondage=GETPOST("sondage",'alpha'); } } $object=new Opensurveysondage($db); -$expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); +$expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); @@ -94,7 +94,7 @@ if ($action == 'update') $object->mail_admin = GETPOST('nouvelleadresse'); $object->date_fin = $expiredate; $object->survey_link_visible = GETPOST('survey_link_visible')=='on'?1:0; - $object->canedit = GETPOST('canedit')=='on'?1:0; + $object->canedit = GETPOST('canedit')=='on'?1:0; $res=$object->update($user); if ($res < 0) @@ -153,13 +153,13 @@ if ($idcomment) $form=new Form($db); -$result=$object->fetch(0,$numsondage); -if ($result <= 0) -{ - print $langs->trans("ErrorRecordNotFound"); - llxFooter(); - exit; -} +$result=$object->fetch(0,$numsondage); +if ($result <= 0) +{ + print $langs->trans("ErrorRecordNotFound"); + llxFooter(); + exit; +} $arrayofjs=array(); $arrayofcss=array('/opensurvey/css/style.css'); @@ -248,24 +248,24 @@ if ($action == 'edit') else print dol_print_email($object->mail_admin); print ''; -// Can edit other votes +// Can edit other votes print ''.$langs->trans('CanEditVotes').''; if ($action == 'edit') { print 'canedit?' checked="true"':'').'">'; } else print yn($object->canedit); -print ''; +print ''; -// Expire date +// Expire date print ''.$langs->trans('ExpireDate').''; if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object->date_fin,'expire'); else print dol_print_date($object->date_fin,'day'); -print ''; +print ''; // Link -print ''.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').''; +print ''.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').''; // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); diff --git a/htdocs/opensurvey/adminstuds_preview.php b/htdocs/opensurvey/adminstuds_preview.php index 27ca8814774..3e7ba2fd7e3 100755 --- a/htdocs/opensurvey/adminstuds_preview.php +++ b/htdocs/opensurvey/adminstuds_preview.php @@ -26,7 +26,7 @@ require_once('../main.inc.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"); -require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); +require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); // Security check @@ -39,7 +39,7 @@ $numsondageadmin=GETPOST("sondage"); $numsondage=substr($numsondageadmin, 0, 16); $object=new Opensurveysondage($db); -$result=$object->fetch(0,$numsondage); +$result=$object->fetch(0,$numsondage); if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage); $nblignes=count($object->fetch_lines()); @@ -49,7 +49,7 @@ $nblignes=count($object->fetch_lines()); * Actions */ -$nbcolonnes = substr_count($object->sujet, ',') + 1; +$nbcolonnes = substr_count($object->sujet, ',') + 1; // Add vote if (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"])) @@ -74,7 +74,7 @@ if (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"])) } } - $nom=substr(GETPOST("nom"),0,64); + $nom=substr(GETPOST("nom"),0,64); // Check if vote already exists $sql = 'SELECT id_users, nom'; @@ -147,23 +147,23 @@ if ($testmodifier) if (! $resql) dol_print_error($db); } -// Add column (not for date) -if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && ($object->format == "A" || $object->format == "A+")) -{ - $nouveauxsujets=$object->sujet; - - //on rajoute la valeur a la fin de tous les sujets deja entrés - $nouveauxsujets.=','; - $nouveauxsujets.=str_replace(array(",","@"), " ", $_POST["nouvellecolonne"]).(empty($_POST["typecolonne"])?'':'@'.$_POST["typecolonne"]); - - //mise a jour avec les nouveaux sujets dans la base +// Add column (not for date) +if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && ($object->format == "A" || $object->format == "A+")) +{ + $nouveauxsujets=$object->sujet; + + //on rajoute la valeur a la fin de tous les sujets deja entrés + $nouveauxsujets.=','; + $nouveauxsujets.=str_replace(array(",","@"), " ", $_POST["nouvellecolonne"]).(empty($_POST["typecolonne"])?'':'@'.$_POST["typecolonne"]); + + //mise a jour avec les nouveaux sujets dans la base $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($nouveauxsujets)."'"; - $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; + $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; dol_syslog("sql=".$sql); $resql = $db->query($sql); - if (! $resql) dol_print_error($db); -} + if (! $resql) dol_print_error($db); +} // Add column (with format date) if (isset($_POST["ajoutercolonne"]) && ($object->format == "D" || $object->format == "D+")) @@ -236,12 +236,12 @@ if (isset($_POST["ajoutercolonne"]) && ($object->format == "D" || $object->forma //mise a jour avec les nouveaux sujets dans la base if (isset($erreur_ajout_date) && !$erreur_ajout_date) { - $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; + $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($dateinsertion)."'"; - $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; + $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; dol_syslog("sql=".$sql); - $resql = $db->query($sql); - if (! $resql) dol_print_error($db); + $resql = $db->query($sql); + if (! $resql) dol_print_error($db); if ($nouvelledate > strtotime($object->date_fin)) { @@ -251,7 +251,7 @@ if (isset($_POST["ajoutercolonne"]) && ($object->format == "D" || $object->forma $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; dol_syslog("sql=".$sql); $resql = $db->query($sql); - if (! $resql) dol_print_error($db); + if (! $resql) dol_print_error($db); } } @@ -270,17 +270,17 @@ for ($i = 0; $i < $nblignes; $i++) { $compteur=0; - // Loop on each answer - $compteur = 0; - $sql ="SELECT id_users, nom, id_sondage, reponses"; - $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; - $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog('sql='.$sql); - $resql=$db->query($sql); - if (! $resql) dol_print_error($db); - $num=$db->num_rows($resql); - while ($compteur < $num) - { + // Loop on each answer + $compteur = 0; + $sql ="SELECT id_users, nom, id_sondage, reponses"; + $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; + $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; + dol_syslog('sql='.$sql); + $resql=$db->query($sql); + if (! $resql) dol_print_error($db); + $num=$db->num_rows($resql); + while ($compteur < $num) + { $obj=$db->fetch_object($resql); if ($compteur==$i) @@ -327,20 +327,20 @@ for ($i = 0; $i < $nbcolonnes; $i++) if (! $resql) dol_print_error($db); // Clean current answer to remove deleted columns - $compteur = 0; - $sql ="SELECT id_users, nom, id_sondage, reponses"; - $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; - $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog('sql='.$sql); - $resql=$db->query($sql); - if (! $resql) - { - dol_print_error($db); - exit; - } - $num=$db->num_rows($resql); - while ($compteur < $num) - { + $compteur = 0; + $sql ="SELECT id_users, nom, id_sondage, reponses"; + $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; + $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; + dol_syslog('sql='.$sql); + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + $num=$db->num_rows($resql); + while ($compteur < $num) + { $obj=$db->fetch_object($resql); $newcar = ''; @@ -379,13 +379,13 @@ for ($i = 0; $i < $nbcolonnes; $i++) $form=new Form($db); -$result=$object->fetch(0,$numsondage); -if ($result <= 0) -{ - print $langs->trans("ErrorRecordNotFound"); - llxFooter(); - exit; -} +$result=$object->fetch(0,$numsondage); +if ($result <= 0) +{ + print $langs->trans("ErrorRecordNotFound"); + llxFooter(); + exit; +} $arrayofjs=array(); $arrayofcss=array('/opensurvey/css/style.css'); @@ -768,7 +768,7 @@ while ($compteur < $num) for ($i = 0; $i < $nbcolonnes; $i++) { $car = substr($ensemblereponses, $i, 1); - //print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz'; + //print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz'; if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) { @@ -1065,7 +1065,7 @@ if ($nbofcheckbox >= 2) print ''."\n"; -print ''."\n"; +print ''."\n"; llxFooterSurvey(); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 188e830be63..72cb620c462 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -91,7 +91,7 @@ class Opensurveysondage extends CommonObject if (isset($this->format)) $this->format=trim($this->format); if (isset($this->mailsonde)) $this->mailsonde=trim($this->mailsonde); if (isset($this->survey_link_visible)) $this->survey_link_visible=trim($this->survey_link_visible); - if (isset($this->canedit)) $this->canedit=trim($this->canedit); + if (isset($this->canedit)) $this->canedit=trim($this->canedit); @@ -111,7 +111,7 @@ class Opensurveysondage extends CommonObject $sql.= "format,"; $sql.= "mailsonde,"; $sql.= "survey_link_visible,"; - $sql.= "canedit"; + $sql.= "canedit"; $sql.= ") VALUES ("; $sql.= " ".(! isset($this->id_sondage)?'NULL':"'".$this->id_sondage."'").","; @@ -124,7 +124,7 @@ class Opensurveysondage extends CommonObject $sql.= " ".(! isset($this->format)?'NULL':"'".$this->db->escape($this->format)."'").","; $sql.= " ".(! isset($this->mailsonde)?'NULL':"'".$this->mailsonde."'").","; $sql.= " ".(! isset($this->survey_link_visible)?'NULL':"'".$this->survey_link_visible."'").","; - $sql.= " ".(! isset($this->canedit)?'NULL':"'".$this->canedit."'").""; + $sql.= " ".(! isset($this->canedit)?'NULL':"'".$this->canedit."'").""; $sql.= ")"; @@ -267,7 +267,7 @@ class Opensurveysondage extends CommonObject if (isset($this->format)) $this->format=trim($this->format); if (isset($this->mailsonde)) $this->mailsonde=trim($this->mailsonde); if (isset($this->survey_link_visible)) $this->survey_link_visible=trim($this->survey_link_visible); - if (isset($this->canedit)) $this->canedit=trim($this->canedit); + if (isset($this->canedit)) $this->canedit=trim($this->canedit); // Check parameters @@ -286,7 +286,7 @@ class Opensurveysondage extends CommonObject $sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").","; $sql.= " mailsonde=".(isset($this->mailsonde)?$this->mailsonde:"null").","; $sql.= " survey_link_visible=".(isset($this->survey_link_visible)?$this->survey_link_visible:"null").","; - $sql.= " canedit=".(isset($this->canedit)?$this->canedit:"null").""; + $sql.= " canedit=".(isset($this->canedit)?$this->canedit:"null").""; //$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE id_sondage_admin='".$this->id_sondage_admin."'"; @@ -348,7 +348,7 @@ class Opensurveysondage extends CommonObject $numsondage=substr($numsondageadmin, 0, 16); $this->db->begin(); - + if (! $error) { if (! $notrigger) @@ -367,13 +367,13 @@ class Opensurveysondage extends CommonObject if (! $error) { - - $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage = '".$numsondage."'"; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); - $resql=$this->db->query($sql); - $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage = '".$numsondage."'"; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); - $resql=$this->db->query($sql); + + $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage = '".$numsondage."'"; + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); + $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage = '".$numsondage."'"; + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " WHERE id_sondage_admin = '".$numsondageadmin."'"; @@ -507,7 +507,7 @@ class Opensurveysondage extends CommonObject $this->format=''; $this->mailsonde=''; $this->survey_link_visible=''; - $this->canedit=0; + $this->canedit=0; } } diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index e2dbcd39af1..f83cb029207 100755 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -22,77 +22,77 @@ */ - -/** - * Show header for new member - * - * @param string $title Title - * @param string $head Head array - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header - * @param array $arrayofjs Array of complementary js files - * @param array $arrayofcss Array of complementary css files - * @return void - */ -function llxHeaderSurvey($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='') -{ - global $user, $conf, $langs, $mysoc; - - top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - print ''; - - showlogo(); - - print '
        '; -} - -/** - * Show footer for new member - * - * @return void - */ -function llxFooterSurvey() -{ - print '
        '; - - printCommonFooter('public'); - - dol_htmloutput_events(); - - print "\n"; - print "\n"; + +/** + * Show header for new member + * + * @param string $title Title + * @param string $head Head array + * @param int $disablejs More content into html header + * @param int $disablehead More content into html header + * @param array $arrayofjs Array of complementary js files + * @param array $arrayofcss Array of complementary css files + * @return void + */ +function llxHeaderSurvey($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='') +{ + global $user, $conf, $langs, $mysoc; + + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + print ''; + + showlogo(); + + print '
        '; } - -/** - * Show logo - * - * @return void - */ -function showlogo() -{ - global $user, $conf, $langs, $mysoc; - - // Print logo - $urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; - - if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small); - } - elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo); - $width=128; - } - elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) - { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; - } - print '
        '; - print 'Logo
        '; - print ''.$langs->trans("OpenSurvey").''; - print '

        '; +/** + * Show footer for new member + * + * @return void + */ +function llxFooterSurvey() +{ + print '
        '; + + printCommonFooter('public'); + + dol_htmloutput_events(); + + print "\n"; + print "\n"; +} + + +/** + * Show logo + * + * @return void + */ +function showlogo() +{ + global $user, $conf, $langs, $mysoc; + + // Print logo + $urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; + + if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small); + } + elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo); + $width=128; + } + elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) + { + $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + } + print '
        '; + print 'Logo
        '; + print ''.$langs->trans("OpenSurvey").''; + print '

        '; } @@ -105,10 +105,10 @@ function get_server_name() { global $dolibarr_main_url_root; - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + $url=$urlwithouturlroot.dol_buildpath('/opensurvey/',1); if (!preg_match("|/$|", $url)) { @@ -171,94 +171,94 @@ function getUrlSondage($id, $admin = false) return $url; } - -/** - * Generate a random id + +/** + * Generate a random id * - * @param string $car Char to generate key - * @return void - */ -function dol_survey_random($car) -{ - $string = ""; - $chaine = "abcdefghijklmnopqrstuvwxyz123456789"; - srand((double) microtime()*1000000); - for($i=0; $i<$car; $i++) { - $string .= $chaine[rand()%strlen($chaine)]; - } - return $string; -} - -/** - * Add a poll - * - * @param string $origin Origin of poll creation - * @return void - */ -function ajouter_sondage($origin) -{ - global $conf, $db; - - $sondage=dol_survey_random(16); - $sondage_admin=$sondage.dol_survey_random(8); - - if ($_SESSION["formatsondage"]=="A"||$_SESSION["formatsondage"]=="A+") { - //extraction de la date de fin choisie - if ($_SESSION["champdatefin"]) { - if ($_SESSION["champdatefin"]>time()+250000) { - $date_fin=$_SESSION["champdatefin"]; - } - } else { - $date_fin=time()+15552000; - } - } - - if ($_SESSION["formatsondage"]=="D"||$_SESSION["formatsondage"]=="D+") { - //Calcul de la date de fin du sondage - $taille_tableau=count($_SESSION["totalchoixjour"])-1; - $date_fin=$_SESSION["totalchoixjour"][$taille_tableau]+200000; - } - - if (is_numeric($date_fin) === false) { - $date_fin = time()+15552000; + * @param string $car Char to generate key + * @return void + */ +function dol_survey_random($car) +{ + $string = ""; + $chaine = "abcdefghijklmnopqrstuvwxyz123456789"; + srand((double) microtime()*1000000); + for($i=0; $i<$car; $i++) { + $string .= $chaine[rand()%strlen($chaine)]; } - $canedit=empty($_SESSION['formatcanedit'])?'0':'1'; - - // Insert survey - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_sondage'; - $sql.= '(id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde, canedit, origin, sujet)'; - $sql.= " VALUES ('".$db->escape($sondage)."', '".$db->escape($_SESSION['commentaires'])."', '".$db->escape($_SESSION['adresse'])."', '".$db->escape($_SESSION['nom'])."',"; - $sql.= " '".$db->escape($_SESSION['titre'])."', '".$sondage_admin."', '".$db->idate($date_fin)."', '".$_SESSION['formatsondage']."', '".$db->escape($_SESSION['mailsonde'])."',"; - $sql.= " '".$canedit."', '".$db->escape($origin)."',"; - $sql.= " '".$db->escape($_SESSION['toutchoix'])."'"; - $sql.= ")"; - dol_syslog($sql); - $resql=$db->query($sql); - - if ($origin == 'dolibarr') $urlback=dol_buildpath('/opensurvey/adminstuds_preview.php',1).'?sondage='.$sondage_admin; - else - { - // Define $urlwithroot - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - - $url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$sondage; - - $urlback=$url; - - //var_dump($urlback);exit; - } - - unset($_SESSION["titre"]); - unset($_SESSION["nom"]); - unset($_SESSION["adresse"]); - unset($_SESSION["commentaires"]); - unset($_SESSION["canedit"]); - unset($_SESSION["mailsonde"]); - - header("Location: ".$urlback); - exit(); + return $string; +} + +/** + * Add a poll + * + * @param string $origin Origin of poll creation + * @return void + */ +function ajouter_sondage($origin) +{ + global $conf, $db; + + $sondage=dol_survey_random(16); + $sondage_admin=$sondage.dol_survey_random(8); + + if ($_SESSION["formatsondage"]=="A"||$_SESSION["formatsondage"]=="A+") { + //extraction de la date de fin choisie + if ($_SESSION["champdatefin"]) { + if ($_SESSION["champdatefin"]>time()+250000) { + $date_fin=$_SESSION["champdatefin"]; + } + } else { + $date_fin=time()+15552000; + } + } + + if ($_SESSION["formatsondage"]=="D"||$_SESSION["formatsondage"]=="D+") { + //Calcul de la date de fin du sondage + $taille_tableau=count($_SESSION["totalchoixjour"])-1; + $date_fin=$_SESSION["totalchoixjour"][$taille_tableau]+200000; + } + + if (is_numeric($date_fin) === false) { + $date_fin = time()+15552000; + } + $canedit=empty($_SESSION['formatcanedit'])?'0':'1'; + + // Insert survey + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_sondage'; + $sql.= '(id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde, canedit, origin, sujet)'; + $sql.= " VALUES ('".$db->escape($sondage)."', '".$db->escape($_SESSION['commentaires'])."', '".$db->escape($_SESSION['adresse'])."', '".$db->escape($_SESSION['nom'])."',"; + $sql.= " '".$db->escape($_SESSION['titre'])."', '".$sondage_admin."', '".$db->idate($date_fin)."', '".$_SESSION['formatsondage']."', '".$db->escape($_SESSION['mailsonde'])."',"; + $sql.= " '".$canedit."', '".$db->escape($origin)."',"; + $sql.= " '".$db->escape($_SESSION['toutchoix'])."'"; + $sql.= ")"; + dol_syslog($sql); + $resql=$db->query($sql); + + if ($origin == 'dolibarr') $urlback=dol_buildpath('/opensurvey/adminstuds_preview.php',1).'?sondage='.$sondage_admin; + else + { + // Define $urlwithroot + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + $url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$sondage; + + $urlback=$url; + + //var_dump($urlback);exit; + } + + unset($_SESSION["titre"]); + unset($_SESSION["nom"]); + unset($_SESSION["adresse"]); + unset($_SESSION["commentaires"]); + unset($_SESSION["canedit"]); + unset($_SESSION["mailsonde"]); + + header("Location: ".$urlback); + exit(); } diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 37f975d1f40..a7f88631dd8 100755 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -50,16 +50,16 @@ print_fiche_titre($langs->trans("OpenSurveyArea")); echo $langs->trans("NoSurveysInDatabase",$nbsondages).'

        '."\n"; -// Link -print img_picto('','object_globe.png').' '.$langs->trans("PublicLinkToCreateSurvey").':
        '; - -// Define $urlwithroot -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - -$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/index.php',1); -$urllink=''.$url.''; +// Link +print img_picto('','object_globe.png').' '.$langs->trans("PublicLinkToCreateSurvey").':
        '; + +// Define $urlwithroot +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + +$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/index.php',1); +$urllink=''.$url.''; print $urllink; diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index c87526ce5ca..908a01db8fd 100755 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -14,11 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -/** - * \file htdocs/opensurvey/list.php - * \ingroup opensurvey - * \brief Page to list surveys + +/** + * \file htdocs/opensurvey/list.php + * \ingroup opensurvey + * \brief Page to list surveys */ require_once('../main.inc.php'); @@ -27,14 +27,14 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); $action=GETPOST('action'); $id=GETPOST('id'); -$numsondage=substr($id, 0, 16); +$numsondage=substr($id, 0, 16); -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="p.titre"; -if ($page < 0) { - $page = 0; -} -$limit = $conf->liste_limit; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="p.titre"; +if ($page < 0) { + $page = 0; +} +$limit = $conf->liste_limit; $offset = $limit * $page; @@ -46,10 +46,10 @@ if ($action == 'delete_confirm') { $db->begin(); - $object=new Opensurveysondage($db); + $object=new Opensurveysondage($db); + + $result=$object->delete($user,'',$numsondageadmin); - $result=$object->delete($user,'',$numsondageadmin); - $db->commit(); } @@ -81,14 +81,14 @@ print ''. $langs->trans("Survey").''. $lang $sql = "SELECT id_sondage, id_sondage_admin, mail_admin, format, origin, date_fin, titre, nom_admin"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; -// Count total nb of records -$nbtotalofrecords = 0; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) -{ - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); } -$sql.= " ORDER BY $sortfield $sortorder "; +$sql.= " ORDER BY $sortfield $sortorder "; $sql.= " ".$db->plimit($conf->liste_limit+1, $offset); $resql=$db->query($sql); diff --git a/htdocs/opensurvey/public/choix_autre.php b/htdocs/opensurvey/public/choix_autre.php index 5975f9d4a0c..e120bd7ec20 100755 --- a/htdocs/opensurvey/public/choix_autre.php +++ b/htdocs/opensurvey/public/choix_autre.php @@ -28,87 +28,87 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); -$erreur = false; -$testdate = true; -$date_selected = ''; +$erreur = false; +$testdate = true; +$date_selected = ''; + +$origin=GETPOST('origin','alpha'); -$origin=GETPOST('origin','alpha'); - /* * Action */ -// Set session vars -$erreur_injection = false; -if (isset($_SESSION["nbrecases"])) { - for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) { - if (isset($_POST["choix"][$i])) { - $_SESSION["choix$i"]=$_POST["choix"][$i]; - } - if (isset($_POST["typecolonne"][$i])) { - $_SESSION["typecolonne$i"]=$_POST["typecolonne"][$i]; - } - } -} else { //nombre de cases par défaut - $_SESSION["nbrecases"]=5; -} - -if (isset($_POST["ajoutcases"]) || isset($_POST["ajoutcases_x"])) { - $_SESSION["nbrecases"]=$_SESSION["nbrecases"]+5; -} +// Set session vars +$erreur_injection = false; +if (isset($_SESSION["nbrecases"])) { + for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) { + if (isset($_POST["choix"][$i])) { + $_SESSION["choix$i"]=$_POST["choix"][$i]; + } + if (isset($_POST["typecolonne"][$i])) { + $_SESSION["typecolonne$i"]=$_POST["typecolonne"][$i]; + } + } +} else { //nombre de cases par défaut + $_SESSION["nbrecases"]=5; +} + +if (isset($_POST["ajoutcases"]) || isset($_POST["ajoutcases_x"])) { + $_SESSION["nbrecases"]=$_SESSION["nbrecases"]+5; +} + +// Create survey into database +if (isset($_POST["confirmecreation"]) || isset($_POST["confirmecreation_x"])) +{ + //recuperation des données de champs textes + $toutchoix = ''; + for ($i = 0; $i < $_SESSION["nbrecases"] + 1; $i++) + { + if (! empty($_POST["choix"][$i])) + { + $toutchoix.=','; + $toutchoix.=str_replace(array(",","@"), " ", $_POST["choix"][$i]).(empty($_POST["typecolonne"][$i])?'':'@'.$_POST["typecolonne"][$i]); + } + } + + $toutchoix=substr("$toutchoix",1); + $_SESSION["toutchoix"]=$toutchoix; -// Create survey into database -if (isset($_POST["confirmecreation"]) || isset($_POST["confirmecreation_x"])) -{ - //recuperation des données de champs textes - $toutchoix = ''; - for ($i = 0; $i < $_SESSION["nbrecases"] + 1; $i++) - { - if (! empty($_POST["choix"][$i])) - { - $toutchoix.=','; - $toutchoix.=str_replace(array(",","@"), " ", $_POST["choix"][$i]).(empty($_POST["typecolonne"][$i])?'':'@'.$_POST["typecolonne"][$i]); - } - } - - $toutchoix=substr("$toutchoix",1); - $_SESSION["toutchoix"]=$toutchoix; - if (GETPOST('champdatefin')) - { - $registredate=explode("/",$_POST["champdatefin"]); - if (is_array($registredate) === false || count($registredate) !== 3) { - $testdate = false; - $date_selected = $_POST["champdatefin"]; - } else { - $time = mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]); - if ($time === false || date('d/m/Y', $time) !== $_POST["champdatefin"]) { - $testdate = false; - $date_selected = $_POST["champdatefin"]; - } else { - if (mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]) > time() + 250000) { - $_SESSION["champdatefin"]=mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]); - } - } - } - } else { - $_SESSION["champdatefin"]=time()+15552000; - } - - if ($testdate === true) - { - //format du sondage AUTRE - $_SESSION["formatsondage"]="A"; - $_SESSION["caneditsondage"]=$_SESSION["canedit"]; + { + $registredate=explode("/",$_POST["champdatefin"]); + if (is_array($registredate) === false || count($registredate) !== 3) { + $testdate = false; + $date_selected = $_POST["champdatefin"]; + } else { + $time = mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]); + if ($time === false || date('d/m/Y', $time) !== $_POST["champdatefin"]) { + $testdate = false; + $date_selected = $_POST["champdatefin"]; + } else { + if (mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]) > time() + 250000) { + $_SESSION["champdatefin"]=mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]); + } + } + } + } else { + $_SESSION["champdatefin"]=time()+15552000; + } - // Add into database - ajouter_sondage($origin); - } else { - $_POST["fin_sondage_autre"] = 'ok'; - } -} + if ($testdate === true) + { + //format du sondage AUTRE + $_SESSION["formatsondage"]="A"; + $_SESSION["caneditsondage"]=$_SESSION["canedit"]; + + // Add into database + ajouter_sondage($origin); + } else { + $_POST["fin_sondage_autre"] = 'ok'; + } +} @@ -119,16 +119,16 @@ if (isset($_POST["confirmecreation"]) || isset($_POST["confirmecreation_x"])) $form=new Form($db); -$arrayofjs=array(); -$arrayofcss=array('/opensurvey/css/style.css'); -llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss); - -if (empty($_SESSION['titre']) || empty($_SESSION['nom']) || empty($_SESSION['adresse'])) -{ - dol_print_error('',"You haven't filled the first section of the poll creation"); - llxFooterSurvey(); - exit; -} +$arrayofjs=array(); +$arrayofcss=array('/opensurvey/css/style.css'); +llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss); + +if (empty($_SESSION['titre']) || empty($_SESSION['nom']) || empty($_SESSION['adresse'])) +{ + dol_print_error('',"You haven't filled the first section of the poll creation"); + llxFooterSurvey(); + exit; +} //partie creation du sondage dans la base SQL @@ -150,8 +150,8 @@ for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) { $_SESSION["choix$i"] = ''; } print ''. $langs->trans("TitleChoice") .' '.$j.' : '; - $tmparray=array('checkbox'=>$langs->trans("CheckBox"),'yesno'=>$langs->trans("YesNoList"),'foragainst'=>$langs->trans("PourContreList")); - print '   '.$langs->trans("Type").' '.$form->selectarray("typecolonne[]", $tmparray, $_SESSION["typecolonne$i"]); + $tmparray=array('checkbox'=>$langs->trans("CheckBox"),'yesno'=>$langs->trans("YesNoList"),'foragainst'=>$langs->trans("PourContreList")); + print '   '.$langs->trans("Type").' '.$form->selectarray("typecolonne[]", $tmparray, $_SESSION["typecolonne$i"]); print ''."\n"; } diff --git a/htdocs/opensurvey/public/choix_date.php b/htdocs/opensurvey/public/choix_date.php index 46d5377c432..f651a91899d 100755 --- a/htdocs/opensurvey/public/choix_date.php +++ b/htdocs/opensurvey/public/choix_date.php @@ -28,56 +28,56 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); -$origin=GETPOST('origin','alpha'); +$origin=GETPOST('origin','alpha'); /* * Actions */ - -// Insert survey + +// Insert survey if (GETPOST('confirmation') || GETPOST('confirmation_x')) -{ +{ if (is_array($_SESSION['totalchoixjour'])) { - $nbofchoice=count($_SESSION["totalchoixjour"]); + $nbofchoice=count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) - { - if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") { - $choixdate.=","; - $choixdate .= $_SESSION["totalchoixjour"][$i]; - } else { - for ($j=0;$j<$_SESSION["nbrecaseshoraires"];$j++) { - if ($_SESSION["horaires$i"][$j]!="") { - $choixdate.=","; - $choixdate .= $_SESSION["totalchoixjour"][$i]; - $choixdate.="@"; - // On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite - $choixdate .= str_replace(array(',', '@'), array(',', '@'), $_SESSION["horaires$i"][$j]); - } - } - } - } + { + if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") { + $choixdate.=","; + $choixdate .= $_SESSION["totalchoixjour"][$i]; + } else { + for ($j=0;$j<$_SESSION["nbrecaseshoraires"];$j++) { + if ($_SESSION["horaires$i"][$j]!="") { + $choixdate.=","; + $choixdate .= $_SESSION["totalchoixjour"][$i]; + $choixdate.="@"; + // On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite + $choixdate .= str_replace(array(',', '@'), array(',', '@'), $_SESSION["horaires$i"][$j]); + } + } + } + } } - else dol_print_error('','array not defined'); - - $_SESSION["toutchoix"]=substr("$choixdate",1); - ajouter_sondage($origin); -} + else dol_print_error('','array not defined'); -// Reset days -if (GETPOST('reset')) { + $_SESSION["toutchoix"]=substr("$choixdate",1); + ajouter_sondage($origin); +} + +// Reset days +if (GETPOST('reset')) { $nbofchoice=count($_SESSION["totalchoixjour"]); - for ($i = 0; $i < $nbofchoice; $i++) { - for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - unset($_SESSION["horaires$i"][$j]); - } - } - - unset($_SESSION["totalchoixjour"]); - unset($_SESSION["nbrecaseshoraires"]); -} - + for ($i = 0; $i < $nbofchoice; $i++) { + for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { + unset($_SESSION["horaires$i"][$j]); + } + } + + unset($_SESSION["totalchoixjour"]); + unset($_SESSION["nbrecaseshoraires"]); +} + /* @@ -90,9 +90,9 @@ if (! isset($_SESSION['nom']) && ! isset($_SESSION['adresse']) && ! isset($_SESS exit; } -$arrayofjs=array(); -$arrayofcss=array('/opensurvey/css/style.css'); -llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss); +$arrayofjs=array(); +$arrayofcss=array('/opensurvey/css/style.css'); +llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss); //nombre de cases par défaut if (! isset($_SESSION["nbrecaseshoraires"])) @@ -205,8 +205,8 @@ $nbrejourmois = date("t", mktime(0, 0, 0, $_SESSION["mois"], 1, $_SESSION["annee $premierjourmois = date("N", mktime(0, 0, 0, $_SESSION["mois"], 1, $_SESSION["annee"])) - 1; //le format du sondage est DATE -$_SESSION["formatsondage"] = "D"; -$_SESSION["formatcanedit"] = $_SESSION["canedit"]; +$_SESSION["formatsondage"] = "D"; +$_SESSION["formatcanedit"] = $_SESSION["canedit"]; //traduction de la valeur du mois if (is_integer($_SESSION["mois"]) && $_SESSION["mois"] > 0 && $_SESSION["mois"] < 13) @@ -223,7 +223,7 @@ else print '
        '."\n"; print ''; -print '
        '. $langs->trans("CreatePoll")." (2 / 2)" .'
        '."\n"; +print '
        '. $langs->trans("CreatePoll")." (2 / 2)" .'
        '."\n"; //affichage de l'aide pour les jours print '
        '."\n"; @@ -235,7 +235,7 @@ print '
        '."\n"; print ''."\n"; print ''; print ''; print ''."\n"; @@ -594,7 +594,7 @@ print ''."\n"; print '



        '."\n"; print ''."\n"; -llxFooterSurvey(); +llxFooterSurvey(); $db->close(); ?> \ No newline at end of file diff --git a/htdocs/opensurvey/public/create_survey.php b/htdocs/opensurvey/public/create_survey.php index 2010a6fdd03..31d57975cc3 100755 --- a/htdocs/opensurvey/public/create_survey.php +++ b/htdocs/opensurvey/public/create_survey.php @@ -21,24 +21,24 @@ * \brief Page to create a new survey */ -define("NOLOGIN",1); // This means this output page does not require to be logged. -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +define("NOLOGIN",1); // This means this output page does not require to be logged. +define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require_once('../../main.inc.php'); -require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); -$langs->load("opensurvey"); +$langs->load("opensurvey"); $origin=GETPOST('origin','alpha'); -// On teste toutes les variables pour supprimer l'ensemble des warnings PHP -// On transforme en entites html les données afin éviter les failles XSS -$post_var = array('titre', 'nom', 'adresse', 'commentaires', 'canedit', 'mailsonde', 'creation_sondage_date', 'creation_sondage_date_x', 'creation_sondage_autre', 'creation_sondage_autre_x'); +// On teste toutes les variables pour supprimer l'ensemble des warnings PHP +// On transforme en entites html les données afin éviter les failles XSS +$post_var = array('titre', 'nom', 'adresse', 'commentaires', 'canedit', 'mailsonde', 'creation_sondage_date', 'creation_sondage_date_x', 'creation_sondage_autre', 'creation_sondage_autre_x'); foreach ($post_var as $var) -{ - $$var = GETPOST($var); +{ + $$var = GETPOST($var); } // On initialise egalement la session car sinon bonjour les warning :-) @@ -101,9 +101,9 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre") || GET * View */ -$arrayofjs=array(); -$arrayofcss=array('/opensurvey/css/style.css'); -llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss); +$arrayofjs=array(); +$arrayofcss=array('/opensurvey/css/style.css'); +llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss); print '
        '. $langs->trans("CreatePoll").' (1 / 2)' .'
        '."\n"; diff --git a/htdocs/opensurvey/public/exportcsv.php b/htdocs/opensurvey/public/exportcsv.php index f933b37a317..5fded4f5d32 100755 --- a/htdocs/opensurvey/public/exportcsv.php +++ b/htdocs/opensurvey/public/exportcsv.php @@ -22,32 +22,32 @@ */ -define("NOLOGIN",1); // This means this output page does not require to be logged. -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +define("NOLOGIN",1); // This means this output page does not require to be logged. +define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require_once('../../main.inc.php'); -require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"); -$action=GETPOST('action'); -$numsondage = $numsondageadmin = ''; -if (GETPOST('sondage')) -{ - if (strlen(GETPOST('sondage')) == 24) // recuperation du numero de sondage admin (24 car.) dans l'URL - { - $numsondageadmin=GETPOST("sondage",'alpha'); - $numsondage=substr($numsondageadmin, 0, 16); - } - else - { - $numsondageadmin=''; - $numsondage=GETPOST("sondage",'alpha'); - } +$action=GETPOST('action'); +$numsondage = $numsondageadmin = ''; +if (GETPOST('sondage')) +{ + if (strlen(GETPOST('sondage')) == 24) // recuperation du numero de sondage admin (24 car.) dans l'URL + { + $numsondageadmin=GETPOST("sondage",'alpha'); + $numsondage=substr($numsondageadmin, 0, 16); + } + else + { + $numsondageadmin=''; + $numsondage=GETPOST("sondage",'alpha'); + } } -$object=new Opensurveysondage($db); -$result=$object->fetch(0,$numsondage); -if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage); +$object=new Opensurveysondage($db); +$result=$object->fetch(0,$numsondage); +if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage); /* @@ -122,8 +122,8 @@ if ($resql) } else if ($car == "2") { - $input.='KO;'; - $somme[$k]++; + $input.='KO;'; + $somme[$k]++; } else { diff --git a/htdocs/opensurvey/public/index.php b/htdocs/opensurvey/public/index.php index 557142d691d..3d5c81f9262 100755 --- a/htdocs/opensurvey/public/index.php +++ b/htdocs/opensurvey/public/index.php @@ -16,18 +16,18 @@ */ -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); -define("NOLOGIN",1); // This means this output page does not require to be logged. -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +define("NOLOGIN",1); // This means this output page does not require to be logged. +define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require_once('../../main.inc.php'); -require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); @@ -46,15 +46,15 @@ llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss); print '
        - -
        -

        '.$langs->trans("OpenSurveyDesc").' '.$langs->trans("OpenSurveyNoRegistration").'

        + +
        +

        '.$langs->trans("OpenSurveyDesc").' '.$langs->trans("OpenSurveyNoRegistration").'


        '; -print $langs->trans("OrganizeYourMeetingEasily").' -
        -
        -
        -
        +print $langs->trans("OrganizeYourMeetingEasily").' +
        +
        +
        +
        '; llxFooterSurvey(); diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php index 9da1c4f79cb..62e78f172ee 100755 --- a/htdocs/opensurvey/public/studs.php +++ b/htdocs/opensurvey/public/studs.php @@ -26,32 +26,32 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require_once('../../main.inc.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"); +require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"); require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"); // Init vars $action=GETPOST('action'); -$numsondage = $numsondageadmin = ''; -if (GETPOST('sondage')) -{ - if (strlen(GETPOST('sondage')) == 24) // recuperation du numero de sondage admin (24 car.) dans l'URL - { - $numsondageadmin=GETPOST("sondage",'alpha'); - $numsondage=substr($numsondageadmin, 0, 16); - } - else - { - $numsondageadmin=''; - $numsondage=GETPOST("sondage",'alpha'); - } -} +$numsondage = $numsondageadmin = ''; +if (GETPOST('sondage')) +{ + if (strlen(GETPOST('sondage')) == 24) // recuperation du numero de sondage admin (24 car.) dans l'URL + { + $numsondageadmin=GETPOST("sondage",'alpha'); + $numsondage=substr($numsondageadmin, 0, 16); + } + else + { + $numsondageadmin=''; + $numsondage=GETPOST("sondage",'alpha'); + } +} $object=new Opensurveysondage($db); $result=$object->fetch(0,$numsondage); if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage); -$nblignes=count($object->fetch_lines()); +$nblignes=count($object->fetch_lines()); /* @@ -60,7 +60,7 @@ $nblignes=count($object->fetch_lines()); $nbcolonnes = substr_count($object->sujet, ',') + 1; -$listofvoters=explode(',',$_SESSION["savevoter"]); +$listofvoters=explode(',',$_SESSION["savevoter"]); // Add comment if (GETPOST('ajoutcomment')) @@ -106,7 +106,7 @@ if (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"])) } else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') { - $nouveauchoix.="2"; + $nouveauchoix.="2"; } else { // sinon c'est 0 $nouveauchoix.="0"; @@ -134,7 +134,7 @@ if (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"])) { // Add voter to session $_SESSION["savevoter"]=$nom.','.(empty($_SESSION["savevoter"])?'':$_SESSION["savevoter"]); // Save voter - $listofvoters=explode(',',$_SESSION["savevoter"]); + $listofvoters=explode(',',$_SESSION["savevoter"]); if (! empty($object->mailsonde)) { @@ -162,62 +162,62 @@ if (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"])) // Update vote -$testmodifier = false; -$testligneamodifier = false; -$ligneamodifier = -1; -for ($i=0; $i<$nblignes; $i++) -{ - if (isset($_POST['modifierligne'.$i])) - { - $ligneamodifier=$i; - $testligneamodifier=true; - } - - //test pour voir si une ligne est a modifier - if (isset($_POST['validermodifier'.$i])) - { - $modifier=$i; - $testmodifier=true; - } +$testmodifier = false; +$testligneamodifier = false; +$ligneamodifier = -1; +for ($i=0; $i<$nblignes; $i++) +{ + if (isset($_POST['modifierligne'.$i])) + { + $ligneamodifier=$i; + $testligneamodifier=true; + } + + //test pour voir si une ligne est a modifier + if (isset($_POST['validermodifier'.$i])) + { + $modifier=$i; + $testmodifier=true; + } } if ($testmodifier) { - //var_dump($_POST);exit; - $nouveauchoix = ''; - for ($i=0;$i<$nbcolonnes;$i++) + //var_dump($_POST);exit; + $nouveauchoix = ''; + for ($i=0;$i<$nbcolonnes;$i++) { - //var_dump($_POST["choix$i"]); - if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') - { - $nouveauchoix.="1"; - } - else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') - { - $nouveauchoix.="2"; - } - else { // sinon c'est 0 - $nouveauchoix.="0"; - } - } + //var_dump($_POST["choix$i"]); + if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') + { + $nouveauchoix.="1"; + } + else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') + { + $nouveauchoix.="2"; + } + else { // sinon c'est 0 + $nouveauchoix.="0"; + } + } - $idtomodify=$_POST["idtomodify".$modifier]; - $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs"; - $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'"; - $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; - - dol_syslog("sql=".$sql); - $resql = $db->query($sql); - if (! $resql) dol_print_error($db); + $idtomodify=$_POST["idtomodify".$modifier]; + $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs"; + $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'"; + $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; + + dol_syslog("sql=".$sql); + $resql = $db->query($sql); + if (! $resql) dol_print_error($db); } -// Delete comment -$idcomment=GETPOST('deletecomment','int'); -if ($idcomment) -{ - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$idcomment; - $resql = $db->query($sql); -} +// Delete comment +$idcomment=GETPOST('deletecomment','int'); +if ($idcomment) +{ + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$idcomment; + $resql = $db->query($sql); +} @@ -228,21 +228,21 @@ if ($idcomment) $form=new Form($db); $object=new OpenSurveySondage($db); -$result=$object->fetch(0,$numsondage); -if ($result <= 0) -{ - print $langs->trans("ErrorRecordNotFound"); - llxFooterSurvey(); - exit; +$result=$object->fetch(0,$numsondage); +if ($result <= 0) +{ + print $langs->trans("ErrorRecordNotFound"); + llxFooterSurvey(); + exit; } -$arrayofjs=array(); -$arrayofcss=array('/opensurvey/css/style.css'); -llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); - +$arrayofjs=array(); +$arrayofcss=array('/opensurvey/css/style.css'); +llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); -// Define format of choices -$toutsujet=explode(",",$object->sujet); + +// Define format of choices +$toutsujet=explode(",",$object->sujet); $listofanswers=array(); foreach ($toutsujet as $value) { @@ -253,7 +253,7 @@ $toutsujet=str_replace("°","'",$toutsujet); print '
        '.$langs->trans("YouAreInivitedToVote").'
        '; -print $langs->trans("OpenSurveyHowTo").'

        '; +print $langs->trans("OpenSurveyHowTo").'

        '; print '
        '."\n"; @@ -657,12 +657,12 @@ for ($i = 0; $i < $nbcolonnes; $i++) { if ($object->format=="D"||$object->format=="D+") { $meilleursujetexport = $toutsujet[$i]; - if (strpos($toutsujet[$i], '@') !== false) { - $toutsujetdate = explode("@", $toutsujet[$i]); - $meilleursujet .= dol_print_date($toutsujetdate[0],'daytext'). ' ('.dol_print_date($toutsujetdate[0],'%A').')' . _("for") . ' ' . $toutsujetdate[1]; - } else { - $meilleursujet .= dol_print_date($toutsujet[$i],'daytext'). ' ('.dol_print_date($toutsujet[$i],'%A').')'; - } + if (strpos($toutsujet[$i], '@') !== false) { + $toutsujetdate = explode("@", $toutsujet[$i]); + $meilleursujet .= dol_print_date($toutsujetdate[0],'daytext'). ' ('.dol_print_date($toutsujetdate[0],'%A').')' . _("for") . ' ' . $toutsujetdate[1]; + } else { + $meilleursujet .= dol_print_date($toutsujet[$i],'daytext'). ' ('.dol_print_date($toutsujet[$i],'%A').')'; + } } else { @@ -696,52 +696,52 @@ if ($nbofcheckbox >= 2) print '
        '; -// Comment list -$sql = 'SELECT id_comment, usercomment, comment'; -$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments'; -$sql.= " WHERE id_sondage='".$db->escape($numsondage)."'"; -$sql.= " ORDER BY id_comment"; -$resql = $db->query($sql); -$num_rows=$db->num_rows($resql); -if ($num_rows > 0) -{ - $i = 0; +// Comment list +$sql = 'SELECT id_comment, usercomment, comment'; +$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments'; +$sql.= " WHERE id_sondage='".$db->escape($numsondage)."'"; +$sql.= " ORDER BY id_comment"; +$resql = $db->query($sql); +$num_rows=$db->num_rows($resql); +if ($num_rows > 0) +{ + $i = 0; print "
        " . $langs->trans("CommentsOfVoters") . " :
        \n"; - while ( $i < $num_rows) - { + while ( $i < $num_rows) + { $obj=$db->fetch_object($resql); - print '
        '; + print '
        '; if (in_array($obj->usercomment, $listofvoters)) print ' '.img_picto('', 'delete.png').' '; - print $obj->usercomment.' : '.dol_nl2br($obj->comment)."
        "; - $i++; - } -} + print $obj->usercomment.' :
        '.dol_nl2br($obj->comment)."
        "; + $i++; + } +} // Form to add comment print '
        ' .$langs->trans("AddACommentForPoll") . "
        \n"; print '
        '."\n"; -print $langs->trans("Name") .' : '; -print '   '."\n"; +print $langs->trans("Name") .' : '; +print '   '."\n"; print '
        '."\n"; print ''."\n"; print '
        '."\n"; // div add comment -print '

        '; +print '

        '; /* -// Define $urlwithroot -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - -$message=''; -$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$numsondage; -$urlvcal=''.$url.''; -$message.=img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey").': '.$urlvcal; - -print '
        '.$message.'
        '; +// Define $urlwithroot +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + +$message=''; +$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$numsondage; +$urlvcal=''.$url.''; +$message.=img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey").': '.$urlvcal; + +print '
        '.$message.'
        '; */ diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c44b8907be5..98236be4778 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1853,7 +1853,7 @@ class Product extends CommonObject function del_sousproduit($fk_parent, $fk_child) { if (! is_numeric($fk_parent)) $fk_parent=0; - if (! is_numeric($fk_child)) $fk_child=0; + if (! is_numeric($fk_child)) $fk_child=0; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_association"; $sql.= " WHERE fk_product_pere = ".$fk_parent; @@ -2142,7 +2142,7 @@ class Product extends CommonObject $id=(! empty($desc_pere[0]) ? $desc_pere[0] :''); $nb=(! empty($desc_pere[1]) ? $desc_pere[1] :''); $type=(! empty($desc_pere[2]) ? $desc_pere[2] :''); - $label=(! empty($desc_pere[3]) ? $desc_pere[3] :''); + $label=(! empty($desc_pere[3]) ? $desc_pere[3] :''); if ($multiply < 1) $multiply=1; //print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n"; @@ -2388,9 +2388,9 @@ class Product extends CommonObject $lien = ''; $lienfin=''; } - else if ($option == 'category') - { - $lien = ''; + else if ($option == 'category') + { + $lien = ''; } else { diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index f7b5fa76650..f011c39f63c 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -66,7 +66,7 @@ else } -print '
        '; +print '
        '; print_projecttasks_array($db,$socid,$projectsListId,$mine); diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index a99366d9a36..d48b0effe6b 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -33,11 +33,11 @@ $langs->load("main"); $langs->load("install"); $langs->load("other"); -$conf->dol_hide_topmenu=GETPOST('dol_hide_topmenu'); -$conf->dol_hide_leftmenu=GETPOST('dol_hide_leftmenu'); -$conf->dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen'); -$conf->dol_no_mouse_hover=GETPOST('dol_no_mouse_hover'); -$conf->dol_use_jmobile=GETPOST('dol_use_jmobile'); +$conf->dol_hide_topmenu=GETPOST('dol_hide_topmenu'); +$conf->dol_hide_leftmenu=GETPOST('dol_hide_leftmenu'); +$conf->dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen'); +$conf->dol_no_mouse_hover=GETPOST('dol_no_mouse_hover'); +$conf->dol_use_jmobile=GETPOST('dol_use_jmobile'); // Security check global $dolibarr_main_demo; @@ -47,8 +47,8 @@ if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo mu $res=$hookmanager->initHooks(array('demo')); $demoprofiles=array(); -$alwayscheckedmodules=array(); -$alwaysuncheckedmodules=array(); +$alwayscheckedmodules=array(); +$alwaysuncheckedmodules=array(); $alwayshiddencheckedmodules=array(); $alwayshiddenuncheckedmodules=array(); @@ -228,12 +228,12 @@ if (GETPOST("action") == 'gotodemo') // Do redirect to login page if ($disablestring) { - $url=''; - $url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:''); - $url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:''); - $url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:''); - $url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:''); - $url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:''); + $url=''; + $url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:''); + $url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:''); + $url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:''); + $url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:''); + $url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:''); if (GETPOST('urlfrom')) $url.=($url?'&':'').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); $url=DOL_URL_ROOT.'/index.php?'.($url?$url.'&':'').'disablemodules='.$disablestring; header("Location: ".$url); @@ -247,60 +247,60 @@ if (GETPOST("action") == 'gotodemo') */ $head=''; -$head.=''."\n"; -$head.=''."\n"; -$head.=' -'; llxHeaderVierge($langs->trans("DolibarrDemo"), $head); diff --git a/htdocs/public/emailing/mailing-read.php b/htdocs/public/emailing/mailing-read.php index e44342278f0..81d218cec78 100644 --- a/htdocs/public/emailing/mailing-read.php +++ b/htdocs/public/emailing/mailing-read.php @@ -26,10 +26,10 @@ */ if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu /** * Header empty @@ -55,13 +55,13 @@ $securitykey=GETPOST('securitykey'); * Actions */ -dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); - +dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); + if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) { print 'Bad security key value.'; exit; -} +} if (! empty($tag)) { diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index 8585b19cd4a..3f86685fad3 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -25,16 +25,16 @@ * \brief Script use to update unsubcribe contact to prospect mailing list */ -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu -/** - * Header empty - * - * @return void - */ -function llxHeader() { } +/** + * Header empty + * + * @return void + */ +function llxHeader() { } /** * Footer empty * @@ -53,15 +53,15 @@ $langs->load("mails"); $tag=GETPOST('tag'); $unsuscrib=GETPOST('unsuscrib'); -$securitykey=GETPOST('securitykey'); +$securitykey=GETPOST('securitykey'); /* * Actions */ -dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); - +dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); + if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) { print 'Bad security key value.'; diff --git a/htdocs/public/offline.php b/htdocs/public/offline.php index d97c8e6e7f3..a52b446b4bb 100644 --- a/htdocs/public/offline.php +++ b/htdocs/public/offline.php @@ -23,8 +23,8 @@ * \brief Dolibarr offline page */ -define('NOCSRFCHECK',1); -define('NOLOGIN',1); +define('NOCSRFCHECK',1); +define('NOLOGIN',1); require '../main.inc.php'; diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index 24be3c5af6f..c4457ff4d93 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -63,29 +63,29 @@ foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); -// Send an email -if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fulltag)) -{ - $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; - $from=$conf->global->MAILING_EMAIL_FROM; - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; +// Send an email +if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fulltag)) +{ + $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; + $from=$conf->global->MAILING_EMAIL_FROM; + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile( - 'New subscription payed', - $sendto, + 'New subscription payed', + $sendto, $from, 'New subscription payed '.$fulltag - ); + ); - $result=$mailfile->sendfile(); - if ($result) - { - dol_syslog("EMail sent to ".$sendto); - } - else - { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR); - } -} + $result=$mailfile->sendfile(); + if ($result) + { + dol_syslog("EMail sent to ".$sendto); + } + else + { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR); + } +} llxHeaderPayBox($langs->trans("PaymentForm")); diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index 33107883d8f..b8940fa1a32 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -41,15 +41,15 @@ $langs->load("companies"); $langs->load("paybox"); $langs->load("paypal"); -/*$source=GETPOST('source'); -$ref=GETPOST('ref'); -$PAYBOXTOKEN=GETPOST('TOKEN'); -if (empty($PAYBOXTOKEN)) $PAYBOXTOKEN=GETPOST('token'); -$PAYBOXPAYERID=GETPOST('PAYERID'); -if (empty($PAYBOXPAYERID)) $PAYBOXPAYERID=GETPOST('PayerID'); +/*$source=GETPOST('source'); +$ref=GETPOST('ref'); +$PAYBOXTOKEN=GETPOST('TOKEN'); +if (empty($PAYBOXTOKEN)) $PAYBOXTOKEN=GETPOST('token'); +$PAYBOXPAYERID=GETPOST('PAYERID'); +if (empty($PAYBOXPAYERID)) $PAYBOXPAYERID=GETPOST('PayerID'); */ -$PAYBOXFULLTAG=GETPOST('FULLTAG'); -if (empty($PAYBOXFULLTAG)) $PAYBOXFULLTAG=GETPOST('fulltag'); +$PAYBOXFULLTAG=GETPOST('FULLTAG'); +if (empty($PAYBOXFULLTAG)) $PAYBOXFULLTAG=GETPOST('fulltag'); /* @@ -77,44 +77,44 @@ llxHeaderPayBox($langs->trans("PaymentForm")); print ''."\n"; print '
        '."\n"; -// Get on url call +// Get on url call /* $token = $PAYBOXTOKEN; -*/ -$fulltag = $PAYBOXFULLTAG; -/*$payerID = $PAYBOXPAYERID; -// Set by newpayment.php -$paymentType = $_SESSION['PaymentType']; -$currencyCodeType = $_SESSION['currencyCodeType']; -$FinalPaymentAmt = $_SESSION["Payment_Amount"]; -// From env -$ipaddress = $_SESSION['ipaddress']; - -dol_syslog("Call newpaymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag); -*/ - -// Send an email -if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fulltag)) -{ - $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; - $from=$conf->global->MAILING_EMAIL_FROM; - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; +*/ +$fulltag = $PAYBOXFULLTAG; +/*$payerID = $PAYBOXPAYERID; +// Set by newpayment.php +$paymentType = $_SESSION['PaymentType']; +$currencyCodeType = $_SESSION['currencyCodeType']; +$FinalPaymentAmt = $_SESSION["Payment_Amount"]; +// From env +$ipaddress = $_SESSION['ipaddress']; + +dol_syslog("Call newpaymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag); +*/ + +// Send an email +if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fulltag)) +{ + $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; + $from=$conf->global->MAILING_EMAIL_FROM; + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile( - 'New subscription payed', - $sendto, - $from, + 'New subscription payed', + $sendto, + $from, 'New subscription payed '.$fulltag - ); - - $result=$mailfile->sendfile(); - if ($result) - { - dol_syslog("EMail sent to ".$sendto); - } - else - { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR); - } + ); + + $result=$mailfile->sendfile(); + if ($result) + { + dol_syslog("EMail sent to ".$sendto); + } + else + { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR); + } } diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index ee72206ae52..21d93f3eaa1 100755 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -71,29 +71,29 @@ foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal'); -// Send an email -if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fulltag)) -{ - $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; - $from=$conf->global->MAILING_EMAIL_FROM; - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; +// Send an email +if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fulltag)) +{ + $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; + $from=$conf->global->MAILING_EMAIL_FROM; + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile( - 'New subscription payed', - $sendto, - $from, + 'New subscription payed', + $sendto, + $from, 'New subscription payed '.$fulltag - ); - - $result=$mailfile->sendfile(); - if ($result) - { - dol_syslog("EMail sent to ".$sendto); - } - else - { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR); - } -} + ); + + $result=$mailfile->sendfile(); + if ($result) + { + dol_syslog("EMail sent to ".$sendto); + } + else + { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR); + } +} llxHeaderPaypal($langs->trans("PaymentForm")); diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 012269b8be3..e4ea8a92095 100755 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -81,14 +81,14 @@ if (empty($PAYPAL_API_SIGNATURE)) return -1; } -$source=GETPOST('source'); -$ref=GETPOST('ref'); -$PAYPALTOKEN=GETPOST('TOKEN'); -if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); -$PAYPALPAYERID=GETPOST('PAYERID'); -if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID'); -$PAYPALFULLTAG=GETPOST('FULLTAG'); -if (empty($PAYPALFULLTAG)) $PAYPALFULLTAG=GETPOST('fulltag'); +$source=GETPOST('source'); +$ref=GETPOST('ref'); +$PAYPALTOKEN=GETPOST('TOKEN'); +if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); +$PAYPALPAYERID=GETPOST('PAYERID'); +if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID'); +$PAYPALFULLTAG=GETPOST('FULLTAG'); +if (empty($PAYPALFULLTAG)) $PAYPALFULLTAG=GETPOST('fulltag'); /* @@ -135,23 +135,23 @@ if ($PAYPALTOKEN) { $sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile( - 'New subscription payed', + 'New subscription payed', $sendto, - $from, + $from, 'New subscription payed '.$fulltag - ); - - $result=$mailfile->sendfile(); - if ($result) - { - dol_syslog("EMail sent to ".$sendto); - } - else - { + ); + + $result=$mailfile->sendfile(); + if ($result) + { + dol_syslog("EMail sent to ".$sendto); + } + else + { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR); - } + } } diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 61c01b00f2a..0fb2da5a053 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -66,8 +66,8 @@ else //ini_set('default_socket_timeout', $params['response_timeout']); //$soapclient = new SoapClient($WS_DOL_URL_WSDL,$params); $soapclient = new nusoap_client($WS_DOL_URL_WSDL,true,$params['proxy_host'],$params['proxy_port'],$params['proxy_login'],$params['proxy_password'],$params['connection_timeout'],$params['response_timeout']); - $soapclient->soap_defencoding = 'utf-8'; - $soapclient->xml_encoding = 'utf-8'; + $soapclient->soap_defencoding = 'utf-8'; + $soapclient->xml_encoding = 'utf-8'; $soapclient->decode_utf8 = false; // Check for an error diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f998f563729..b6bee432087 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1452,14 +1452,14 @@ class Societe extends CommonObject { $lien = 'url='http://www.specimen.com'; $this->phone='0909090901'; - $this->fax='0909090909'; + $this->fax='0909090909'; $this->code_client='CC-'.dol_print_date($now,'dayhourlog'); $this->code_fournisseur='SC-'.dol_print_date($now,'dayhourlog'); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 27db36e8a32..356001648c3 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -443,10 +443,10 @@ if (empty($reshook)) } // Set parent company - if ($action == 'set_thirdparty' && $user->rights->societe->creer) + if ($action == 'set_thirdparty' && $user->rights->societe->creer) { - $result = $object->set_parent(GETPOST('editparentcompany','int')); - } + $result = $object->set_parent(GETPOST('editparentcompany','int')); + } /* * Generate document @@ -1721,24 +1721,24 @@ else // Parent company if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { - // Payment term - print '
        '; - print ''; + // Payment term + print ''; + print ''; } // Sales representative diff --git a/htdocs/support/index.php b/htdocs/support/index.php index 6b555672631..5d2d7fb5104 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -175,7 +175,7 @@ print ''; print '
        '.$motmois.' '.$_SESSION["annee"].'
        '; -print ''; +print ''; print '
        '; print '
        '; - print ''; - if ($action != 'editparentcompany') print ''; - print '
        '; - print $langs->trans('ParentCompany'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'
        '; - print '
        '; - if ($action == 'editparentcompany') - { - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->parent,'editparentcompany','s.rowid <> '.$object->id,1); - } - else - { - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->parent,'none','s.rowid <> '.$object->id,1); - } - print '
        '; + print ''; + if ($action != 'editparentcompany') print ''; + print '
        '; + print $langs->trans('ParentCompany'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'
        '; + print '
        '; + if ($action == 'editparentcompany') + { + $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->parent,'editparentcompany','s.rowid <> '.$object->id,1); + } + else + { + $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->parent,'none','s.rowid <> '.$object->id,1); + } + print '
        '."\n"; -print '
        '; // Other support diff --git a/htdocs/theme/amarok/graph-color.php b/htdocs/theme/amarok/graph-color.php index 1a0d2253a2a..be8421b6d4b 100755 --- a/htdocs/theme/amarok/graph-color.php +++ b/htdocs/theme/amarok/graph-color.php @@ -22,10 +22,10 @@ * \ingroup core */ -global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; -$theme_bordercolor = array(235,235,224); -$theme_datacolor = array(array(190,190,220), array(200,160,180), array(125,135,150), array(170,140,190), array(190,190,170)); -$theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); -$theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); +global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; +$theme_bordercolor = array(235,235,224); +$theme_datacolor = array(array(190,190,220), array(200,160,180), array(125,135,150), array(170,140,190), array(190,190,170)); +$theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); +$theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); ?> diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 4f55463a323..6c5ca41d52b 100755 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -41,8 +41,8 @@ session_cache_limiter(FALSE); require_once '../../main.inc.php'; -// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) -if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); +// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) +if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); // Define css type header('Content-type: text/css'); @@ -72,109 +72,109 @@ $fontlist='helvetica,arial,tahoma,verdana'; //$fontlist='Verdana,Helvetica,Ar $img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); $img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); -$dol_hide_topmenu=$conf->dol_hide_topmenu; -$dol_hide_leftmenu=$conf->dol_hide_leftmenu; -$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; -$dol_no_mouse_hover=$conf->dol_no_mouse_hover; -$dol_use_jmobile=$conf->dol_use_jmobile; +$dol_hide_topmenu=$conf->dol_hide_topmenu; +$dol_hide_leftmenu=$conf->dol_hide_leftmenu; +$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; +$dol_no_mouse_hover=$conf->dol_no_mouse_hover; +$dol_use_jmobile=$conf->dol_use_jmobile; - -// Define reference colors -// Example: Light grey: $colred=235;$colgreen=235;$colblue=235; -// Example: Pink: $colred=230;$colgreen=210;$colblue=230; -// Example: Green: $colred=210;$colgreen=230;$colblue=210; -// Example: Ocean: $colred=220;$colgreen=220;$colblue=240; -//$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; -//$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; -//var_dump($user->conf->THEME_ELDY_RGB); -$colred =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,0,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,0,2))); -$colgreen=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,2,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,2,2))); -$colblue =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,4,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,4,2))); - -// Colors -$isred=max(0,(2*$colred-$colgreen-$colblue)/2); // 0 - 255 -$isgreen=max(0,(2*$colgreen-$colred-$colblue)/2); // 0 - 255 -$isblue=max(0,(2*$colblue-$colred-$colgreen)/2); // 0 - 255 -$colorback1=($colred-3).','.($colgreen-3).','.($colblue-3); // topmenu -$colorback2=($colred+5).','.($colgreen+5).','.($colblue+5); -$colorbacktab1=($colred+15).','.($colgreen+16).','.($colblue+17); // vmenu -$colorbacktab1b=($colred+5).','.($colgreen+6).','.($colblue+7); // vmenu (not menu) -$colorbacktab2=($colred-15).','.($colgreen-15).','.($colblue-15); -$colorbacktitle1=($colred-5).','.($colgreen-5).','.($colblue-5); // title of array -$colorbacktitle2=($colred-15).','.($colgreen-15).','.($colblue-15); -$colorbacktabcard1=($colred+15).','.($colgreen+16).','.($colblue+17); // card -$colorbacktabcard2=($colred-15).','.($colgreen-15).','.($colblue-15); -$colorbacktabactive=($colred-15).','.($colgreen-15).','.($colblue-15); -$colorbacklineimpair1=(244+round($isred/3)).','.(244+round($isgreen/3)).','.(244+round($isblue/3)); // line impair -$colorbacklineimpair2=(250+round($isred/3)).','.(250+round($isgreen/3)).','.(250+round($isblue/3)); // line impair -$colorbacklineimpairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); // line impair -$colorbacklinepair1='255,255,255'; // line pair -$colorbacklinepair2='255,255,255'; // line pair -$colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); -$colorbackbody='#f5f5f5'; -$colortext='40,40,40'; -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'14'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'14'; -$colorback1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorback1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorback1:$user->conf->THEME_ELDY_TOPMENU_BACK1); -$colorback2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK2)?$colorback2:$conf->global->THEME_ELDY_TOPMENU_BACK2) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK2)?$colorback2:$user->conf->THEME_ELDY_TOPMENU_BACK2); -$colorbacktab1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbacktab1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbacktab1:$user->conf->THEME_ELDY_VERMENU_BACK1); -$colorbacktab1b =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1b)?$colorbacktab1:$conf->global->THEME_ELDY_VERMENU_BACK1b) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1b)?$colorbacktab1b:$user->conf->THEME_ELDY_VERMENU_BACK1b); -$colorbacktab2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK2)?$colorbacktab2:$conf->global->THEME_ELDY_VERMENU_BACK2) :(empty($user->conf->THEME_ELDY_VERMENU_BACK2)?$colorbacktab2:$user->conf->THEME_ELDY_VERMENU_BACK2); -$colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1); -$colorbacktitle2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE2) ?$colorbacktitle2:$conf->global->THEME_ELDY_BACKTITLE2) :(empty($user->conf->THEME_ELDY_BACKTITLE2)?$colorbacktitle2:$user->conf->THEME_ELDY_BACKTITLE2); -$colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1); -$colorbacktabcard2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD2) ?$colorbacktabcard2:$conf->global->THEME_ELDY_BACKTABCARD2) :(empty($user->conf->THEME_ELDY_BACKTABCARD2)?$colorbacktabcard2:$user->conf->THEME_ELDY_BACKTABCARD2); -$colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE); -$colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR1) ?$colorbacklineimpair1:$conf->global->THEME_ELDY_LINEIMPAIR1):(empty($user->conf->THEME_ELDY_LINEIMPAIR1)?$colorbacklineimpair1:$user->conf->THEME_ELDY_LINEIMPAIR1); -$colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2); -$colorbacklineimpairhover=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIRHOVER) ?$colorbacklineimpairhover:$conf->global->THEME_ELDY_LINEIMPAIRHOVER):(empty($user->conf->THEME_ELDY_LINEIMPAIRHOVER)?$colorbacklineimpairhover:$user->conf->THEME_ELDY_LINEIMPAIRHOVER); -$colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1); -$colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2); -$colorbacklinepairhover =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIRHOVER) ?$colorbacklinepairhover:$conf->global->THEME_ELDY_LINEPAIRHOVER) :(empty($user->conf->THEME_ELDY_LINEPAIRHOVER)?$colorbacklinepairhover:$user->conf->THEME_ELDY_LINEPAIRHOVER); -$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY); -$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT); -$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1); -$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2); -// No hover by default, we keep only if we set var THEME_ELDY_USE_HOVER -if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf->THEME_ELDY_USE_HOVER)) - || (empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($conf->global->THEME_ELDY_USE_HOVER))) -{ - $colorbacklineimpairhover=''; - $colorbacklinepairhover=''; -} - -// Set text color to black or white -$tmppart=explode(',',$colorback1); -$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : ''); -$tmpval+=(! empty($tmppart[2]) ? $tmppart[2] : ''); -$tmpval+=(! empty($tmppart[3]) ? $tmppart[3] : ''); -//print $tmpval; -if ($tmpval < 340) $colortextmain='FFFFFF'; -else $colortextmain='101010'; - -$usecss3=true; -if ($conf->browser->name == 'ie' && round($conf->browser->version,2) < 10) $usecss3=false; -elseif ($conf->browser->name == 'iceweasel') $usecss3=false; -elseif ($conf->browser->name == 'epiphany') $usecss3=false; - -print '/*'."\n"; -print 'colred='.$colred.' colgreen='.$colgreen.' colblue='.$colblue."\n"; -print 'isred='.$isred.' isgreen='.$isgreen.' isblue='.$isblue."\n"; -print 'colorbacklineimpair1='.$colorbacklineimpair1."\n"; -print 'colorbacklineimpair2='.$colorbacklineimpair2."\n"; -print 'colorbacklineimpairhover='.$colorbacklineimpairhover."\n"; -print 'colorbacklinepair1='.$colorbacklinepair1."\n"; -print 'colorbacklinepair2='.$colorbacklinepair2."\n"; -print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; -print 'usecss3='.$usecss3."\n"; -print 'dol_hide_topmenu='.$dol_hide_topmenu."\n"; -print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n"; -print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n"; -print 'dol_no_mouse_hover='.$dol_no_mouse_hover."\n"; -print 'dol_use_jmobile='.$dol_use_jmobile."\n"; -print '*/'."\n"; - +// Define reference colors +// Example: Light grey: $colred=235;$colgreen=235;$colblue=235; +// Example: Pink: $colred=230;$colgreen=210;$colblue=230; +// Example: Green: $colred=210;$colgreen=230;$colblue=210; +// Example: Ocean: $colred=220;$colgreen=220;$colblue=240; +//$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; +//$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; +//var_dump($user->conf->THEME_ELDY_RGB); +$colred =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,0,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,0,2))); +$colgreen=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,2,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,2,2))); +$colblue =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,4,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,4,2))); + +// Colors +$isred=max(0,(2*$colred-$colgreen-$colblue)/2); // 0 - 255 +$isgreen=max(0,(2*$colgreen-$colred-$colblue)/2); // 0 - 255 +$isblue=max(0,(2*$colblue-$colred-$colgreen)/2); // 0 - 255 +$colorback1=($colred-3).','.($colgreen-3).','.($colblue-3); // topmenu +$colorback2=($colred+5).','.($colgreen+5).','.($colblue+5); +$colorbacktab1=($colred+15).','.($colgreen+16).','.($colblue+17); // vmenu +$colorbacktab1b=($colred+5).','.($colgreen+6).','.($colblue+7); // vmenu (not menu) +$colorbacktab2=($colred-15).','.($colgreen-15).','.($colblue-15); +$colorbacktitle1=($colred-5).','.($colgreen-5).','.($colblue-5); // title of array +$colorbacktitle2=($colred-15).','.($colgreen-15).','.($colblue-15); +$colorbacktabcard1=($colred+15).','.($colgreen+16).','.($colblue+17); // card +$colorbacktabcard2=($colred-15).','.($colgreen-15).','.($colblue-15); +$colorbacktabactive=($colred-15).','.($colgreen-15).','.($colblue-15); +$colorbacklineimpair1=(244+round($isred/3)).','.(244+round($isgreen/3)).','.(244+round($isblue/3)); // line impair +$colorbacklineimpair2=(250+round($isred/3)).','.(250+round($isgreen/3)).','.(250+round($isblue/3)); // line impair +$colorbacklineimpairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); // line impair +$colorbacklinepair1='255,255,255'; // line pair +$colorbacklinepair2='255,255,255'; // line pair +$colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); +$colorbackbody='#f5f5f5'; +$colortext='40,40,40'; +$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'14'; +$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'14'; + +$colorback1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorback1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorback1:$user->conf->THEME_ELDY_TOPMENU_BACK1); +$colorback2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK2)?$colorback2:$conf->global->THEME_ELDY_TOPMENU_BACK2) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK2)?$colorback2:$user->conf->THEME_ELDY_TOPMENU_BACK2); +$colorbacktab1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbacktab1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbacktab1:$user->conf->THEME_ELDY_VERMENU_BACK1); +$colorbacktab1b =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1b)?$colorbacktab1:$conf->global->THEME_ELDY_VERMENU_BACK1b) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1b)?$colorbacktab1b:$user->conf->THEME_ELDY_VERMENU_BACK1b); +$colorbacktab2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK2)?$colorbacktab2:$conf->global->THEME_ELDY_VERMENU_BACK2) :(empty($user->conf->THEME_ELDY_VERMENU_BACK2)?$colorbacktab2:$user->conf->THEME_ELDY_VERMENU_BACK2); +$colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1); +$colorbacktitle2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE2) ?$colorbacktitle2:$conf->global->THEME_ELDY_BACKTITLE2) :(empty($user->conf->THEME_ELDY_BACKTITLE2)?$colorbacktitle2:$user->conf->THEME_ELDY_BACKTITLE2); +$colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1); +$colorbacktabcard2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD2) ?$colorbacktabcard2:$conf->global->THEME_ELDY_BACKTABCARD2) :(empty($user->conf->THEME_ELDY_BACKTABCARD2)?$colorbacktabcard2:$user->conf->THEME_ELDY_BACKTABCARD2); +$colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE); +$colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR1) ?$colorbacklineimpair1:$conf->global->THEME_ELDY_LINEIMPAIR1):(empty($user->conf->THEME_ELDY_LINEIMPAIR1)?$colorbacklineimpair1:$user->conf->THEME_ELDY_LINEIMPAIR1); +$colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2); +$colorbacklineimpairhover=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIRHOVER) ?$colorbacklineimpairhover:$conf->global->THEME_ELDY_LINEIMPAIRHOVER):(empty($user->conf->THEME_ELDY_LINEIMPAIRHOVER)?$colorbacklineimpairhover:$user->conf->THEME_ELDY_LINEIMPAIRHOVER); +$colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1); +$colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2); +$colorbacklinepairhover =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIRHOVER) ?$colorbacklinepairhover:$conf->global->THEME_ELDY_LINEPAIRHOVER) :(empty($user->conf->THEME_ELDY_LINEPAIRHOVER)?$colorbacklinepairhover:$user->conf->THEME_ELDY_LINEPAIRHOVER); +$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY); +$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT); +$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1); +$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2); +// No hover by default, we keep only if we set var THEME_ELDY_USE_HOVER +if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf->THEME_ELDY_USE_HOVER)) + || (empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($conf->global->THEME_ELDY_USE_HOVER))) +{ + $colorbacklineimpairhover=''; + $colorbacklinepairhover=''; +} + +// Set text color to black or white +$tmppart=explode(',',$colorback1); +$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : ''); +$tmpval+=(! empty($tmppart[2]) ? $tmppart[2] : ''); +$tmpval+=(! empty($tmppart[3]) ? $tmppart[3] : ''); +//print $tmpval; +if ($tmpval < 340) $colortextmain='FFFFFF'; +else $colortextmain='101010'; + +$usecss3=true; +if ($conf->browser->name == 'ie' && round($conf->browser->version,2) < 10) $usecss3=false; +elseif ($conf->browser->name == 'iceweasel') $usecss3=false; +elseif ($conf->browser->name == 'epiphany') $usecss3=false; + +print '/*'."\n"; +print 'colred='.$colred.' colgreen='.$colgreen.' colblue='.$colblue."\n"; +print 'isred='.$isred.' isgreen='.$isgreen.' isblue='.$isblue."\n"; +print 'colorbacklineimpair1='.$colorbacklineimpair1."\n"; +print 'colorbacklineimpair2='.$colorbacklineimpair2."\n"; +print 'colorbacklineimpairhover='.$colorbacklineimpairhover."\n"; +print 'colorbacklinepair1='.$colorbacklinepair1."\n"; +print 'colorbacklinepair2='.$colorbacklinepair2."\n"; +print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; +print 'usecss3='.$usecss3."\n"; +print 'dol_hide_topmenu='.$dol_hide_topmenu."\n"; +print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n"; +print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n"; +print 'dol_no_mouse_hover='.$dol_no_mouse_hover."\n"; +print 'dol_use_jmobile='.$dol_use_jmobile."\n"; +print '*/'."\n"; + if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; ?> diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 41bdadf037c..71deed1ce23 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -63,10 +63,10 @@ if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global- // Define image path files $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; -$dol_hide_topmenu=$conf->dol_hide_topmenu; -$dol_hide_leftmenu=$conf->dol_hide_leftmenu; -$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; -$dol_no_mouse_hover=$conf->dol_no_mouse_hover; +$dol_hide_topmenu=$conf->dol_hide_topmenu; +$dol_hide_leftmenu=$conf->dol_hide_leftmenu; +$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; +$dol_no_mouse_hover=$conf->dol_no_mouse_hover; $dol_use_jmobile=$conf->dol_use_jmobile; $img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1);