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

update from upstream
This commit is contained in:
philippe grand 2016-05-08 15:48:01 +02:00
commit ffe0e2b545
59 changed files with 1257 additions and 795 deletions

View File

@ -9,6 +9,7 @@ filter:
- dev/* - dev/*
- doc/* - doc/*
- test/* - test/*
- htdocs/includes/*
paths: paths:
- htdocs/* - htdocs/*
- scripts/* - scripts/*

View File

@ -76,8 +76,6 @@ if ($action == 'add') {
$res = $object->create($user); $res = $object->create($user);
if ($res == 0) {
} else {
if ($res == - 3) { if ($res == - 3) {
$error = 1; $error = 1;
$action = "create"; $action = "create";
@ -87,8 +85,8 @@ if ($action == 'add') {
$action = "create"; $action = "create";
} }
} }
} header("Location: account.php");
Header("Location: account.php"); exit;
} else if ($action == 'edit') { } else if ($action == 'edit') {
if (! GETPOST('cancel', 'alpha')) { if (! GETPOST('cancel', 'alpha')) {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -134,7 +132,8 @@ if ($action == 'add') {
$result = $object->delete($user); $result = $object->delete($user);
if ($result > 0) { if ($result > 0) {
Header("Location: account.php"); header("Location: account.php");
exit;
} }
} }

View File

@ -48,7 +48,7 @@ abstract class ActionsAdherentCardCommon
/** /**
* Instantiation of DAO class * Instantiation of DAO class. Init ->object
* *
* @return int 0 * @return int 0
* @deprecated Using getInstanceDao should not be used. * @deprecated Using getInstanceDao should not be used.
@ -83,18 +83,18 @@ abstract class ActionsAdherentCardCommon
*/ */
function getObject($id) function getObject($id)
{ {
$ret = $this->getInstanceDao(); //$ret = $this->getInstanceDao();
if (is_object($this->object) && method_exists($this->object,'fetch')) /*if (is_object($this->object) && method_exists($this->object,'fetch'))
{ {
if (! empty($id)) $this->object->fetch($id); if (! empty($id)) $this->object->fetch($id);
} }
else else
{ {*/
$object = new Adherent($this->db); $object = new Adherent($this->db);
if (! empty($id)) $object->fetch($id); if (! empty($id)) $object->fetch($id);
$this->object = $object; $this->object = $object;
} //}
} }
/** /**
@ -121,11 +121,11 @@ abstract class ActionsAdherentCardCommon
// Creation user // Creation user
$nuser = new User($this->db); $nuser = new User($this->db);
$result=$nuser->create_from_member($this->object,$_POST["login"]); $result=$nuser->create_from_member($this->object,GETPOST("login"));
if ($result > 0) if ($result > 0)
{ {
$result2=$nuser->setPassword($user,$_POST["password"],0,1,1); $result2=$nuser->setPassword($user,GETPOST("password"),0,1,1);
if ($result2) if ($result2)
{ {
$this->db->commit(); $this->db->commit();
@ -424,13 +424,14 @@ abstract class ActionsAdherentCardCommon
if ($resql) if ($resql)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -28,6 +28,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->load("members"); $langs->load("members");
$langs->load("companies"); $langs->load("companies");
@ -43,6 +44,11 @@ $search_ref=GETPOST("search_ref");
$search_lastname=GETPOST("search_lastname"); $search_lastname=GETPOST("search_lastname");
$search_firstname=GETPOST("search_firstname"); $search_firstname=GETPOST("search_firstname");
$search_login=GETPOST("search_login"); $search_login=GETPOST("search_login");
$search_address=GETPOST("search_address");
$search_zip=GETPOST("search_zip");
$search_town=GETPOST("search_town");
$search_state=GETPOST("search_state");
$search_country=GETPOST("search_country");
$type=GETPOST("type"); $type=GETPOST("type");
$search_email=GETPOST("search_email"); $search_email=GETPOST("search_email");
$search_categ = GETPOST("search_categ",'int'); $search_categ = GETPOST("search_categ",'int');
@ -50,6 +56,8 @@ $catid = GETPOST("catid",'int');
$sall=GETPOST("sall"); $sall=GETPOST("sall");
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
if ($statut < -1) $statut = '';
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -66,7 +74,7 @@ $hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('member'); $extralabels = $extrafields->fetch_name_optionals_label('adherent');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
@ -88,7 +96,7 @@ $arrayfields=array(
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), 'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1), 'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
'd.societe'=>array('label'=>$langs->trans("Company"), 'checked'=>1), 'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1), 'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1), 'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1),
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1), 't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
@ -96,8 +104,10 @@ $arrayfields=array(
'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0), 'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0),
'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0), 'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), 'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'd.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0), 'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500), 'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500),
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
@ -139,10 +149,14 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_address=""; $search_address="";
$search_zip=""; $search_zip="";
$search_town=""; $search_town="";
$search_state="";
$search_country='';
$search_morphy=""; $search_morphy="";
$search_categ=""; $search_categ="";
$catid=""; $catid="";
$sall=""; $sall="";
$statut='';
$search_array_options=array();
} }
@ -160,9 +174,11 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute
$now=dol_now(); $now=dol_now();
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,"; $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
$sql.= " d.datefin,"; $sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
$sql.= " t.libelle as type, t.cotisation"; $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
$sql.= " t.libelle as type, t.cotisation,";
$sql.= " state.code_departement as state_code, state.nom as state_name";
// Add fields for extrafields // Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks // Add fields from hooks
@ -170,7 +186,10 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid "; $sql.= " WHERE d.fk_adherent_type = t.rowid ";
if ($catid > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($catid); if ($catid > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($catid);
@ -180,7 +199,7 @@ if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")"; $sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall); if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall);
if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type); if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type);
if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules if ($statut != '') $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_ref) if ($search_ref)
{ {
if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")"; if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
@ -189,6 +208,10 @@ if ($search_ref)
if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname); if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
if ($search_login) $sql.= natural_search("d.login", $search_login); if ($search_login) $sql.= natural_search("d.login", $search_login);
if ($search_email) $sql.= natural_search("d.email", $search_email); if ($search_email) $sql.= natural_search("d.email", $search_email);
if ($search_town) $sql.= natural_search("d.town",$search_town);
if ($search_zip) $sql.= natural_search("d.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'"; if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')"; if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
@ -253,19 +276,23 @@ if ($resql)
} }
$param=''; $param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($statut != "") $param.="&statut=".$statut; if ($statut != "") $param.="&statut=".urlencode($statut);
if ($search_nom) $param.="&search_nom=".$search_nom; if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
if ($search_firstname) $param.="&search_firstname=".$search_firstname; if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
if ($search_lastname) $param.="&search_lastname=".$search_lastname; if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname);
if ($search_login) $param.="&search_login=".$search_login; if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
if ($search_email) $param.="&search_email=".$search_email; if ($search_login) $param.="&search_login=".urlencode($search_login);
if ($search_company) $param.="&search_company=".$search_company; if ($search_email) $param.="&search_email=".urlencode($search_email);
if ($search_zip) $param.="&search_zip=".$search_zip; if ($search_company) $param.="&search_company=".urlencode($search_company);
if ($search_town) $param.="&search_town=".$search_town; if ($search_address != '') $param.= "&search_address=".urlencode($search_address);
if ($filter) $param.="&filter=".$filter; if ($search_town != '') $param.= "&search_town=".urlencode($search_town);
if ($type > 0) $param.="&type=".$type; if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($search_state != '') $param.= "&search_state=".urlencode($search_state);
if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
if ($filter) $param.="&filter=".urlencode($filter);
if ($type > 0) $param.="&type=".urlencode($type);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {
@ -325,15 +352,17 @@ if ($resql)
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.company','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
@ -350,7 +379,7 @@ if ($resql)
$parameters=array('arrayfields'=>$arrayfields); $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
@ -360,41 +389,146 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Ref // Ref
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['d.ref']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">'; print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['d.firstname']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref" value="'.$search_ref.'" size="4"></td>'; print '<input class="flat" type="text" name="search_ref" value="'.$search_firstname.'" size="6"></td>';
}
if (! empty($arrayfields['d.lastname']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="12"></td>'; print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="6"></td>';
}
if (! empty($arrayfields['d.company']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="7"></td>'; print '<input class="flat" type="text" name="search_company" value="'.$search_company.'" size="6"></td>';
}
if (! empty($arrayfields['d.login']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="6"></td>';
}
if (! empty($arrayfields['d.morphy']['checked']))
{
print '<td class="liste_titre" align="left">';
print '</td>';
}
if (! empty($arrayfields['t.libelle']['checked']))
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$listetype=$membertypestatic->liste_array(); $listetype=$membertypestatic->liste_array();
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32); print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
print '</td>'; print '</td>';
}
print '<td class="liste_titre">&nbsp;</td>'; if (! empty($arrayfields['d.address']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="12"></td>'; print '<input class="flat" type="text" name="search_address" value="'.$search_address.'" size="5"></td>';
}
$parameters=array(); if (! empty($arrayfields['d.zip']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_zip" value="'.$search_zip.'" size="5"></td>';
}
if (! empty($arrayfields['d.town']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_town" value="'.$search_town.'" size="5"></td>';
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
}
// Email
if (! empty($arrayfields['d.email']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="5"></td>';
}
if (! empty($arrayfields['d.datefin']['checked']))
{
print '<td class="liste_titre" align="left">';
print '</td>';
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
print '</td>';
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Status // Status
print '<td class="liste_titre">&nbsp;</td>'; if (! empty($arrayfields['d.statut']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
$liststatus=array(
'-1'=>$langs->trans("Draft"),
'1'=>$langs->trans("Validated"),
'0'=>$langs->trans("Resiliated")
);
print $form->selectarray('statut', $liststatus, $statut, -2);
print '</td>';
}
// Action column // Action column
print '<td class="liste_titre" colspan="2" align="right">'; print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons(0); $searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco; print $searchpitco;
print '</td>'; print '</td>';
@ -404,22 +538,23 @@ if ($resql)
$var=True; $var=True;
while ($i < $num && $i < $conf->liste_limit) while ($i < $num && $i < $conf->liste_limit)
{ {
$objp = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$datefin=$db->jdate($objp->datefin); $datefin=$db->jdate($obj->datefin);
$memberstatic->id=$objp->rowid; $memberstatic->id=$obj->rowid;
$memberstatic->ref=$objp->rowid; $memberstatic->ref=$obj->rowid;
$memberstatic->lastname=$objp->lastname; $memberstatic->lastname=$obj->lastname;
$memberstatic->firstname=$objp->firstname; $memberstatic->firstname=$obj->firstname;
$memberstatic->statut=$objp->statut; $memberstatic->societe=$obj->company;
$memberstatic->statut=$obj->statut;
$memberstatic->datefin= $datefin; $memberstatic->datefin= $datefin;
$memberstatic->socid = $obj->fk_soc;
if (! empty($objp->fk_soc)) { if (! empty($obj->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
$memberstatic->fetch_thirdparty(); $memberstatic->fetch_thirdparty();
$companyname=$memberstatic->thirdparty->name; $companyname=$memberstatic->thirdparty->name;
} else { } else {
$companyname=$objp->company; $companyname=$obj->company;
} }
$var=!$var; $var=!$var;
@ -431,43 +566,99 @@ if ($resql)
} }
// Ref // Ref
if (! empty($arrayfields['d.ref']['checked']))
{
print "<td>"; print "<td>";
print $memberstatic->getNomUrl(1); print $memberstatic->getNomUrl(1);
print "</td>\n"; print "</td>\n";
}
// Lastname // Lastname
print "<td><a href=\"card.php?rowid=$objp->rowid\">"; if (! empty($arrayfields['d.lastname']['checked']))
print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : ''); {
print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : ''); print "<td>";
print (! empty($companyname) ? dol_trunc($companyname, 32) : ''); print $obj->lastname;
print "</a></td>\n"; print "</td>\n";
}
// Firstname
if (! empty($arrayfields['d.firstname']['checked']))
{
print "<td>";
print $obj->firstname;
print "</td>\n";
}
// Company
if (! empty($arrayfields['d.company']['checked']))
{
print "<td>";
print $companyname;
print "</td>\n";
}
// Login // Login
print "<td>".$objp->login."</td>\n"; if (! empty($arrayfields['d.login']['checked']))
{
// Type print "<td>".$obj->login."</td>\n";
$membertypestatic->id=$objp->type_id; }
$membertypestatic->libelle=$objp->type; // Moral/Physique
if (! empty($arrayfields['d.morphy']['checked']))
{
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
}
// Type label
if (! empty($arrayfields['t.libelle']['checked']))
{
$membertypestatic->id=$obj->type_id;
$membertypestatic->libelle=$obj->type;
print '<td class="nowrap">'; print '<td class="nowrap">';
print $membertypestatic->getNomUrl(1,32); print $membertypestatic->getNomUrl(1,32);
print '</td>'; print '</td>';
}
// Moral/Physique // Address
print "<td>".$memberstatic->getmorphylib($objp->morphy)."</td>\n"; if (! empty($arrayfields['d.address']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->address;
print '</td>';
}
// Town
if (! empty($arrayfields['d.town']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Zip
if (! empty($arrayfields['d.zip']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print "<td>".$obj->state_name."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td align="center">';
$tmparray=getCountry($obj->country,'all');
print $tmparray['label'];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// EMail // EMail
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n"; if (! empty($arrayfields['d.email']['checked']))
{
$parameters=array('obj' => $obj); print "<td>".dol_print_email($obj->email,0,0,1)."</td>\n";
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook }
print $hookmanager->resPrint;
// Statut
print '<td class="nowrap">';
print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
print "</td>";
// End of subscription date // End of subscription date
$datefin=$db->jdate($obj->datefin);
if (! empty($arrayfields['d.datefin']['checked']))
{
if ($datefin) if ($datefin)
{ {
print '<td align="center" class="nowrap">'; print '<td align="center" class="nowrap">';
@ -480,10 +671,10 @@ if ($resql)
else else
{ {
print '<td align="left" class="nowrap">'; print '<td align="left" class="nowrap">';
if ($objp->cotisation == 'yes') if ($obj->cotisation == 'yes')
{ {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning(); if ($obj->statut > 0) print " ".img_warning();
} }
else else
{ {
@ -491,23 +682,70 @@ if ($resql)
} }
print '</td>'; print '</td>';
} }
}
// Actions // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
print '<td';
$align=$extrafields->getAlignFlag($key);
if ($align) print ' align="'.$align.'"';
print '>';
$tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
if (! empty($arrayfields['d.statut']['checked']))
{
print '<td align="right" class="nowrap">';
print $memberstatic->LibStatut($obj->statut,$obj->cotisation,$datefin,2);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td align="center">'; print '<td align="center">';
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer)
{ {
print "<a href=\"card.php?rowid=".$objp->rowid."&action=edit&backtopage=1\">".img_edit()."</a>"; print "<a href=\"card.php?rowid=".$obj->rowid."&action=edit&backtopage=1\">".img_edit()."</a>";
} }
print '&nbsp;'; print '&nbsp;';
if ($user->rights->adherent->supprimer && $objp->statut == -1) if ($user->rights->adherent->supprimer && $obj->statut == -1)
{ {
print "<a href=\"card.php?rowid=".$objp->rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png')."</a>"; print "<a href=\"card.php?rowid=".$obj->rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png')."</a>";
} }
if ($user->rights->adherent->supprimer && $objp->statut == 1) if ($user->rights->adherent->supprimer && $obj->statut == 1)
{ {
print "<a href=\"card.php?rowid=".$objp->rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>"; print "<a href=\"card.php?rowid=".$obj->rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
} }
print "</td>"; print "</td>";
if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;

View File

@ -119,19 +119,19 @@ function create_script_table($list)
global $sortby,$bc,$langs; global $sortby,$bc,$langs;
$var=true; $var=true;
if (isset($_GET['order']) && ($_GET['order'] == "asc" || $_GET['order'] =="desc")) { if (GETPOT('order') == "asc" || GETPOST('order') =="desc") {
$order = $_GET['order']; $order = GETPOST('order');
} else { } else {
$order = "asc"; $order = "asc";
} }
if (isset($_GET['sort'])) { if (GETPOST('order')) {
switch ($_GET['sort']) { switch (GETPOST('order')) {
case "mtime": case "mtime":
case "size": case "size":
case "reloads": case "reloads":
case "hits": case "hits":
$sortby = $_GET['sort']; $sortby = GETPOST('sort');
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
break; break;
default: default:

View File

@ -318,7 +318,7 @@ function backup_tables($outputfile, $tables='*')
$columns = count($row); $columns = count($row);
for($j=0; $j<$columns; $j++) { for($j=0; $j<$columns; $j++) {
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier) // Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
if ($row[$j] == null and !is_string($row[$j])) { if ($row[$j] == null && !is_string($row[$j])) {
// IMPORTANT: if the field is NULL we set it NULL // IMPORTANT: if the field is NULL we set it NULL
$row[$j] = 'NULL'; $row[$j] = 'NULL';
} elseif(is_string($row[$j]) && $row[$j] == '') { } elseif(is_string($row[$j]) && $row[$j] == '') {

View File

@ -417,14 +417,7 @@ if ($id)
if (empty($reshook)) if (empty($reshook))
{ {
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit') fieldListWebsites($fieldlist,$obj,$tabname[$id],'add');
{
fieldList($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
} }
if ($id == 4) print '<td></td>'; if ($id == 4) print '<td></td>';
@ -487,46 +480,9 @@ if ($id)
*/ */
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
else $valuetoshow=$langs->trans("Amount");
$align='right';
}
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; }
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
$valuetoshow=$langs->trans("Label");
if ($id != 25) $valuetoshow.="*";
}
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); }
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); }
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); }
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
// Affiche nom du champ // Affiche nom du champ
if ($showfield) if ($showfield)
@ -534,8 +490,6 @@ if ($id)
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder); print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
} }
} }
// Favorite - Only activated on country dictionary
if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
print getTitleFieldOfList(''); print getTitleFieldOfList('');
@ -562,7 +516,7 @@ if ($id)
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors; $error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); if (empty($reshook)) fieldListWebsites($fieldlist,$obj,$tabname[$id],'edit');
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>'; print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
@ -582,172 +536,6 @@ if ($id)
$showfield=1; $showfield=1;
$align="left"; $align="left";
$valuetoshow=$obj->$fieldlist[$field]; $valuetoshow=$obj->$fieldlist[$field];
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
if ($value == 'element')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
else if ($value == 'source')
{
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
}
else if ($valuetoshow=='all') {
$valuetoshow=$langs->trans('All');
}
else if ($fieldlist[$field]=='country') {
if (empty($obj->country_code))
{
$valuetoshow='-';
}
else
{
$key=$langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
}
}
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
$valuetoshow=yn($valuetoshow);
$align="center";
}
else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) {
$valuetoshow=price($valuetoshow);
}
else if ($fieldlist[$field]=='libelle_facture') {
$langs->load("bills");
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
$valuetoshow=nl2br($valuetoshow);
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
$key=$langs->trans("Country".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') {
$langs->load("propal");
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') {
$key=$langs->trans("Action".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
$key=$langs->trans(strtoupper($obj->code));
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
$key=$langs->trans(strtoupper($obj->code));
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
$key=$langs->trans("Civility".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
$langs->load('agenda');
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
$langs->load("bills");
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
$langs->load("bills");
$key=$langs->trans("PaymentType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
$langs->load("orders");
$key=$langs->trans($obj->code);
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->$fieldlist[$field];
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
$langs->load("sendings");
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
}
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
{
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
}
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
{
$langs->load('trips');
$key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
$showfield=0;
}
else if ($fieldlist[$field]=='unicode') {
$valuetoshow = $langs->getCurrencySymbol($obj->code,1);
}
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
$langs->load("products");
$valuetoshow=$langs->trans($obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
$langs->load("products");
$valuetoshow = $langs->trans($obj->$fieldlist[$field]);
}
else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format'))
{
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$fieldlist[$field]);
}
else if ($fieldlist[$field]=='localtax1_type') {
if ($obj->localtax1 != 0)
$valuetoshow=$localtax_typeList[$valuetoshow];
else
$valuetoshow = '';
$align="center";
}
else if ($fieldlist[$field]=='localtax2_type') {
if ($obj->localtax2 != 0)
$valuetoshow=$localtax_typeList[$valuetoshow];
else
$valuetoshow = '';
$align="center";
}
else if ($fieldlist[$field]=='localtax1') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
if ($obj->localtax1 == 0)
$valuetoshow = '';
$align="right";
}
else if ($fieldlist[$field]=='localtax2') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
if ($obj->localtax2 == 0)
$valuetoshow = '';
$align="right";
}
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
{
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
$align="right";
}
else if (in_array($fieldlist[$field],array('recuperableonly')))
{
$align="center";
}
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow = length_accountg($valuetoshow);
}
// Show value for field // Show value for field
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>'; if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
@ -757,16 +545,6 @@ if ($id)
// Can an entry be erased or disabled ? // Can an entry be erased or disabled ?
$iserasable=1;$isdisable=1; // true by default $iserasable=1;$isdisable=1; // true by default
if (isset($obj->code) && $id != 10)
{
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; }
else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; }
else if ($obj->code == 'EF0') { $iserasable = 0; $isdisable = 0; }
}
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $isdisable=0; $isdisable = 0; }
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?urlencode($obj->code):'').'&amp;id='.$id.'&amp;'; $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?urlencode($obj->code):'').'&amp;id='.$id.'&amp;';
// Favorite // Favorite
@ -823,7 +601,7 @@ $db->close();
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void * @return void
*/ */
function fieldList($fieldlist, $obj='', $tabname='', $context='') function fieldListWebsites($fieldlist, $obj='', $tabname='', $context='')
{ {
global $conf,$langs,$db; global $conf,$langs,$db;
global $form; global $form;

View File

@ -167,6 +167,8 @@ class DolibarrApiInit extends DolibarrApi
*/ */
public function login($login, $password, $entity = 0) { public function login($login, $password, $entity = 0) {
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
// Authentication mode // Authentication mode
if (empty($dolibarr_main_authentication)) if (empty($dolibarr_main_authentication))
$dolibarr_main_authentication = 'http,dolibarr'; $dolibarr_main_authentication = 'http,dolibarr';

View File

@ -70,6 +70,7 @@ class DolibarrApiAccess implements iAuthenticate
{ {
global $db; global $db;
$login = '';
$stored_key = ''; $stored_key = '';
$userClass = Defaults::$userIdentifierClass; $userClass = Defaults::$userIdentifierClass;
@ -100,6 +101,10 @@ class DolibarrApiAccess implements iAuthenticate
return false; return false;
} }
if (! $login)
{
throw new RestException(503, 'Error when searching logn user fro mapi key');
}
$fuser = new User($db); $fuser = new User($db);
if(! $fuser->fetch('',$login)) { if(! $fuser->fetch('',$login)) {
throw new RestException(503, 'Error when fetching user :'.$fuser->error); throw new RestException(503, 'Error when fetching user :'.$fuser->error);

View File

@ -45,6 +45,7 @@ class CategoryApi extends DolibarrApi
2 => 'customer', 2 => 'customer',
3 => 'member', 3 => 'member',
4 => 'contact', 4 => 'contact',
5 => 'account',
); );
/** /**

View File

@ -49,6 +49,8 @@ class Categorie extends CommonObject
const TYPE_MEMBER = 3; const TYPE_MEMBER = 3;
const TYPE_CONTACT = 4; const TYPE_CONTACT = 4;
const TYPE_USER = 4; // categorie contact and user are same const TYPE_USER = 4; // categorie contact and user are same
// bank account
const TYPE_ACCOUNT = 5;
/** /**
* @var array ID mapping from type string * @var array ID mapping from type string
@ -62,6 +64,7 @@ class Categorie extends CommonObject
'member' => 3, 'member' => 3,
'contact' => 4, 'contact' => 4,
'user' => 4, 'user' => 4,
'account' => 5,
); );
/** /**
* @var array Foreign keys mapping from type string * @var array Foreign keys mapping from type string
@ -75,6 +78,7 @@ class Categorie extends CommonObject
'member' => 'member', 'member' => 'member',
'contact' => 'socpeople', 'contact' => 'socpeople',
'user' => 'user', 'user' => 'user',
'account' => 'account',
); );
/** /**
* @var array Category tables mapping from type string * @var array Category tables mapping from type string
@ -88,6 +92,7 @@ class Categorie extends CommonObject
'member' => 'member', 'member' => 'member',
'contact' => 'contact', 'contact' => 'contact',
'user' => 'user', 'user' => 'user',
'account' => 'account',
); );
/** /**
* @var array Object class mapping from type string * @var array Object class mapping from type string
@ -101,6 +106,7 @@ class Categorie extends CommonObject
'member' => 'Adherent', 'member' => 'Adherent',
'contact' => 'Contact', 'contact' => 'Contact',
'user' => 'User', 'user' => 'User',
'account' => 'Account',
); );
/** /**
* @var array Object table mapping from type string * @var array Object table mapping from type string
@ -114,6 +120,7 @@ class Categorie extends CommonObject
'member' => 'adherent', 'member' => 'adherent',
'contact' => 'socpeople', 'contact' => 'socpeople',
'user' => 'user', 'user' => 'user',
'account' => 'bank_account',
); );
public $element='category'; public $element='category';
@ -138,6 +145,8 @@ class Categorie extends CommonObject
* @see Categorie::TYPE_CUSTOMER * @see Categorie::TYPE_CUSTOMER
* @see Categorie::TYPE_MEMBER * @see Categorie::TYPE_MEMBER
* @see Categorie::TYPE_CONTACT * @see Categorie::TYPE_CONTACT
* @see Categorie::TYPE_USER
* @see Categorie::TYPE_ACCOUNT
*/ */
var $type; var $type;

View File

@ -53,6 +53,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea"); elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea");
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea"); elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea");
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea");
else $title=$langs->trans("CategoriesArea"); else $title=$langs->trans("CategoriesArea");
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');

View File

@ -93,12 +93,13 @@ $form = new Form($db);
if ($object->id) if ($object->id)
{ {
$title=$langs->trans("ProductsCategoryShort");
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort"); if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort"); elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type); $head = categories_prepare_head($object,$type);
dol_fiche_head($head, 'photos', $title, 0, 'category'); dol_fiche_head($head, 'photos', $title, 0, 'category');

View File

@ -149,6 +149,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort"); elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
else $title=$langs->trans("Category"); else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type); $head = categories_prepare_head($object,$type);

View File

@ -108,6 +108,13 @@ if ($id > 0 && $removeelem > 0)
$result = $tmpobject->fetch($removeelem); $result = $tmpobject->fetch($removeelem);
$elementtype = 'contact'; $elementtype = 'contact';
} }
else if ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$tmpobject = new Account($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'account';
}
$result=$object->del_type($tmpobject,$elementtype); $result=$object->del_type($tmpobject,$elementtype);
if ($result < 0) dol_print_error('',$object->error); if ($result < 0) dol_print_error('',$object->error);
@ -169,6 +176,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort"); elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
else $title=$langs->trans("Category"); else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type); $head = categories_prepare_head($object,$type);
@ -580,6 +588,59 @@ if($object->type == Categorie::TYPE_CONTACT)
} }
} }
// List of accounts
if ($object->type == Categorie::TYPE_ACCOUNT)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accounts = $object->getObjectsInCateg("account");
if ($accounts < 0)
{
dol_print_error($db, $accounts->error, $accounts->errors);
}
else
{
print "<br>";
print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account")."</td></tr>\n";
if (count($accounts) > 0)
{
$var=true;
foreach ($accounts as $key => $account)
{
$var=!$var;
print "\t<tr ".$bc[$var].">\n";
print '<td class="nowrap" valign="top">';
print $account->getNomUrl(1,0);
print "</td>\n";
print '<td valign="top">'.$account->bank."</td>\n";
print '<td valign="top">'.$account->number."</td>\n";
// Link to delete from category
print '<td align="right">';
$typeid=$object->type;
$permission=0;
if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($typeid == Categorie::TYPE_ACCOUNT) $permission=$user->rights->banque->configurer;
if ($permission)
{
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$account->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' ';
print $langs->trans("DeleteFromCat")."</a>";
}
print "</tr>\n";
}
}
else
{
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("ThisCategoryHasNoAccount")."</td></tr>";
}
print "</table>\n";
}
}
llxFooter(); llxFooter();

View File

@ -1173,7 +1173,7 @@ if ($id > 0)
// Clone event // Clone event
if($action == 'clone') if($action == 'clone')
{ {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneAction', $object->label), 'confirm_clone', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneEvent', $object->label), 'confirm_clone', $formquestion, 'yes', 1);
print $formconfirm; print $formconfirm;
} }

View File

@ -309,7 +309,7 @@ if ($resql)
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre(""); print_liste_field_titre("");
print "</tr>\n"; print "</tr>\n";
@ -432,7 +432,7 @@ if ($resql)
print '</td>'; print '</td>';
// Status/Percent // Status/Percent
print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>'; print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
print '<td></td>'; print '<td></td>';

View File

@ -948,7 +948,7 @@ else
} }
} }
print '<br><br></div>'; print '</div>';
} }
// Affichage formulaire de TEST // Affichage formulaire de TEST
@ -1052,20 +1052,25 @@ else
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback);
print '</td></tr>';
// Topic // Topic
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>'; print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
// From // From
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>'; print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
// To // To
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1).'</td></tr>'; print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1).'</td></tr>';
// Status // Status
print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
// Nb of distinct emails // Nb of distinct emails
print '<tr><td width="25%">'; print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients"); print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">'; print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>'); $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@uers.sourceforge.net> * Copyright (C) 2005-2016 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* *
@ -227,7 +227,7 @@ if ($object->fetch($id) >= 0)
// Show email selectors // Show email selectors
if ($allowaddtarget && $user->rights->mailing->creer) if ($allowaddtarget && $user->rights->mailing->creer)
{ {
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"),($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''),''); print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''), 'title_generic');
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -398,11 +398,11 @@ if ($object->fetch($id) >= 0)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
$cleartext='';
if ($allowaddtarget) { if ($allowaddtarget) {
$cleartext='<br></div><div>'.$langs->trans("ToClearAllRecipientsClickHere").': '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">'; $cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">';
} }
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$nbtotalofrecords,'',0,'','',$limit);
print '</form>'; print '</form>';

View File

@ -17,15 +17,14 @@
*/ */
/** /**
* \file class/advtargetemailing.class.php * \file comm/mailing/class/advtargetemailing.class.php
* \ingroup advtargetemailing * \ingroup mailing
* \brief This file is an example CRUD class file (Create/Read/Update/Delete) * \brief This file is an example CRUD class file (Create/Read/Update/Delete)
*/ */
/** /**
* Put your class' description here * Class to manage advanced emailing target selector
*/ */
class AdvanceTargetingMailing extends CommonObject class AdvanceTargetingMailing extends CommonObject
{ {
@ -293,7 +292,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user=0, $notrigger=0) function update($user, $notrigger=0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@ -739,7 +738,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param string $criteria Use %% as magic caracters. For exemple to find all item like <b>jean, joe, jim</b>, you can input <b>j%%</b>, you can also use ; as separator for value, * @param string $criteria Use %% as magic caracters. For exemple to find all item like <b>jean, joe, jim</b>, you can input <b>j%%</b>, you can also use ; as separator for value,
* and use ! for except this value. * and use ! for except this value.
* For exemple jean;joe;jim%%;!jimo;!jima%> will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima * For exemple jean;joe;jim%%;!jimo;!jima%> will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima
* @return int <0 if KO, >0 if OK * @return string Sql to use for the where condition
*/ */
public function transformToSQL($column_to_test,$criteria) { public function transformToSQL($column_to_test,$criteria) {
$return_sql_criteria = '('; $return_sql_criteria = '(';

View File

@ -17,7 +17,8 @@
*/ */
/** /**
* \file advtargetemailing/class/html.formadvtragetemaling.class.php * \file comm/mailing/class/html.formadvtragetemaling.class.php
* \ingroup mailing
* \brief Fichier de la classe des fonctions predefinie de composants html advtargetemaling * \brief Fichier de la classe des fonctions predefinie de composants html advtargetemaling
*/ */
@ -38,8 +39,6 @@ class FormAdvTargetEmailing extends Form
global $langs; global $langs;
$this->db = $db; $this->db = $db;
return 1;
} }
/** /**
@ -89,6 +88,7 @@ class FormAdvTargetEmailing extends Form
global $conf, $langs; global $conf, $langs;
$langs->load("dict"); $langs->load("dict");
$maxlength = 0;
$out = ''; $out = '';
$countryArray = array(); $countryArray = array();
@ -150,7 +150,7 @@ class FormAdvTargetEmailing extends Form
$options_array = array (); $options_array = array ();
$sql_usr = '';
$sql_usr .= "SELECT DISTINCT u2.rowid, u2.lastname as name, u2.firstname, u2.login"; $sql_usr .= "SELECT DISTINCT u2.rowid, u2.lastname as name, u2.firstname, u2.login";
$sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u2, " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; $sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u2, " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
$sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")"; $sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")";
@ -246,11 +246,13 @@ class FormAdvTargetEmailing extends Form
$sql .= ' WHERE ' . $InfoFieldList [3]; $sql .= ' WHERE ' . $InfoFieldList [3];
} }
} }
if (! empty ( $InfoFieldList [1] ) && $key == 'ts_payeur') { if (! empty($InfoFieldList[1])) {
$sql .= " ORDER BY nom"; $sql .= " ORDER BY nom";
} }
// $sql.= ' WHERE entity = '.$conf->entity; // $sql.= ' WHERE entity = '.$conf->entity;
$options_array = array();
dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG); dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
@ -276,7 +278,7 @@ class FormAdvTargetEmailing extends Form
* Return combo list with people title * Return combo list with people title
* *
* @param string $htmlname Name of HTML select combo field * @param string $htmlname Name of HTML select combo field
* @param array $selected_array array * @param array $selected_array Array
* @return string HTML combo * @return string HTML combo
*/ */
function multiselectCivility($htmlname='civilite_id',$selected_array = array()) function multiselectCivility($htmlname='civilite_id',$selected_array = array())
@ -364,14 +366,12 @@ class FormAdvTargetEmailing extends Form
if (count($options_array) > 0) { if (count($options_array) > 0) {
foreach ($options_array as $keyoption => $valoption) { foreach ($options_array as $keyoption => $valoption) {
// If key is in intersect table then it have to e selected // If key is in intersect table then it have to e selected
$selected = '';
if (count ( $intersect_array ) > 0) { if (count ( $intersect_array ) > 0) {
if (array_key_exists ( $keyoption, $intersect_array )) { if (array_key_exists ( $keyoption, $intersect_array )) {
$selected = ' selected="selected"'; $selected = ' selected="selected"';
} else {
$selected = '';
} }
} }
$return .= '<option' . $selected . ' value="' . $keyoption . '">' . $valoption . '</option>'; $return .= '<option' . $selected . ' value="' . $keyoption . '">' . $valoption . '</option>';
} }
} }
@ -455,8 +455,8 @@ class FormAdvTargetEmailing extends Form
* selectAdvtargetemailingTemplate * selectAdvtargetemailingTemplate
* *
* @param string $htmlname control name * @param string $htmlname control name
* @param number $selected defaut selected * @param integer $selected defaut selected
* @param number $showempty empty lines * @param integer $showempty empty lines
* *
* @return string HTML combo * @return string HTML combo
*/ */

View File

@ -780,7 +780,7 @@ class Propal extends CommonObject
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
global $langs,$conf,$mysoc,$hookmanager; global $conf,$hookmanager;
$error=0; $error=0;
$now=dol_now(); $now=dol_now();
@ -1080,7 +1080,7 @@ class Propal extends CommonObject
*/ */
function createFromClone($socid=0) function createFromClone($socid=0)
{ {
global $db, $user,$langs,$conf,$hookmanager; global $user,$conf,$hookmanager;
dol_include_once('/projet/class/project.class.php'); dol_include_once('/projet/class/project.class.php');
@ -1214,7 +1214,6 @@ class Propal extends CommonObject
*/ */
function fetch($rowid,$ref='') function fetch($rowid,$ref='')
{ {
global $conf;
$sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; $sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
@ -1508,7 +1507,7 @@ class Propal extends CommonObject
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $conf,$langs; global $conf;
$error=0; $error=0;
$now=dol_now(); $now=dol_now();
@ -1868,7 +1867,6 @@ class Propal extends CommonObject
*/ */
function reopen($user, $statut, $note='', $notrigger=0) function reopen($user, $statut, $note='', $notrigger=0)
{ {
global $langs,$conf;
$this->statut = $statut; $this->statut = $statut;
$error=0; $error=0;
@ -1979,7 +1977,7 @@ class Propal extends CommonObject
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
//$ret=$object->fetch($id); // Reload to get new records //$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $this->generateDocument($modelpdf, $outputlangs);
} }
// Call trigger // Call trigger
@ -2082,7 +2080,7 @@ class Propal extends CommonObject
*/ */
function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC')
{ {
global $conf,$user; global $user;
$ga = array(); $ga = array();
@ -2247,7 +2245,7 @@ class Propal extends CommonObject
*/ */
function delete($user, $notrigger=0) function delete($user, $notrigger=0)
{ {
global $conf,$langs; global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error=0; $error=0;
@ -2610,7 +2608,7 @@ class Propal extends CommonObject
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
global $user,$langs,$conf; global $langs;
// Charge tableau des produits prodids // Charge tableau des produits prodids
$prodids = array(); $prodids = array();
@ -2696,7 +2694,7 @@ class Propal extends CommonObject
*/ */
function load_state_board() function load_state_board()
{ {
global $conf, $user; global $user;
$this->nb=array(); $this->nb=array();
$clause = "WHERE"; $clause = "WHERE";
@ -2741,7 +2739,7 @@ class Propal extends CommonObject
*/ */
function getNextNumRef($soc) function getNextNumRef($soc)
{ {
global $conf, $db, $langs; global $conf,$langs;
$langs->load("propal"); $langs->load("propal");
if (! empty($conf->global->PROPALE_ADDON)) if (! empty($conf->global->PROPALE_ADDON))
@ -2942,7 +2940,7 @@ class Propal extends CommonObject
*/ */
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf,$user,$langs; global $conf,$langs;
$langs->load("propale"); $langs->load("propale");
@ -3196,7 +3194,7 @@ class PropaleLigne extends CommonObjectLine
*/ */
function insert($notrigger=0) function insert($notrigger=0)
{ {
global $conf,$langs,$user; global $conf,$user;
$error=0; $error=0;
@ -3332,7 +3330,7 @@ class PropaleLigne extends CommonObjectLine
*/ */
function delete() function delete()
{ {
global $conf,$langs,$user; global $conf,$user;
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
@ -3383,7 +3381,7 @@ class PropaleLigne extends CommonObjectLine
*/ */
function update($notrigger=0) function update($notrigger=0)
{ {
global $conf,$langs,$user; global $conf,$user;
$error=0; $error=0;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -204,7 +204,7 @@ class Commande extends CommonOrder
*/ */
function getNextNumRef($soc) function getNextNumRef($soc)
{ {
global $db, $langs, $conf; global $langs, $conf;
$langs->load("order"); $langs->load("order");
if (! empty($conf->global->COMMANDE_ADDON)) if (! empty($conf->global->COMMANDE_ADDON))
@ -239,7 +239,7 @@ class Commande extends CommonOrder
} }
else else
{ {
dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
return ""; return "";
} }
} }
@ -500,7 +500,6 @@ class Commande extends CommonOrder
*/ */
function set_reopen($user) function set_reopen($user)
{ {
global $conf,$langs;
$error=0; $error=0;
if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED) if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED)
@ -560,7 +559,7 @@ class Commande extends CommonOrder
*/ */
function cloture($user) function cloture($user)
{ {
global $conf, $langs; global $conf;
$error=0; $error=0;
@ -697,7 +696,7 @@ class Commande extends CommonOrder
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
global $conf,$langs,$mysoc,$hookmanager; global $conf,$langs;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -971,7 +970,7 @@ class Commande extends CommonOrder
*/ */
function createFromClone($socid=0) function createFromClone($socid=0)
{ {
global $conf,$user,$langs,$hookmanager; global $user,$hookmanager;
$error=0; $error=0;
@ -1061,7 +1060,7 @@ class Commande extends CommonOrder
*/ */
function createFromProposal($object) function createFromProposal($object)
{ {
global $db, $conf,$user,$langs,$hookmanager; global $conf,$user,$hookmanager;
dol_include_once('/core/class/extrafields.class.php'); dol_include_once('/core/class/extrafields.class.php');
@ -1134,7 +1133,7 @@ class Commande extends CommonOrder
// get extrafields from original line // get extrafields from original line
$object->fetch_optionals($object->id); $object->fetch_optionals($object->id);
$e = new ExtraFields($db); $e = new ExtraFields($this->db);
$element_extrafields = $e->fetch_name_optionals_label($this->element); $element_extrafields = $e->fetch_name_optionals_label($this->element);
foreach($object->array_options as $options_key => $value) { foreach($object->array_options as $options_key => $value) {
@ -1495,7 +1494,6 @@ class Commande extends CommonOrder
*/ */
function fetch($id, $ref='', $ref_ext='', $ref_int='') function fetch($id, $ref='', $ref_ext='', $ref_int='')
{ {
global $conf;
// Check parameters // Check parameters
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
@ -1851,10 +1849,9 @@ class Commande extends CommonOrder
* Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order * Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order
* *
* @param int $filtre_statut Filter on status * @param int $filtre_statut Filter on status
* @param int $fk_product Filter on a product
* @return int <0 if KO, Nb of lines found if OK * @return int <0 if KO, Nb of lines found if OK
*/ */
function loadExpeditions($filtre_statut=-1, $fk_product=0) function loadExpeditions($filtre_statut=-1)
{ {
$this->expeditions = array(); $this->expeditions = array();
@ -1983,7 +1980,6 @@ class Commande extends CommonOrder
*/ */
function deleteline($lineid) function deleteline($lineid)
{ {
global $user;
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
{ {
@ -2262,7 +2258,7 @@ class Commande extends CommonOrder
*/ */
function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC')
{ {
global $conf,$user; global $user;
$ga = array(); $ga = array();
@ -2430,7 +2426,7 @@ class Commande extends CommonOrder
*/ */
function classifyBilled(User $user) function classifyBilled(User $user)
{ {
global $conf, $user, $langs; global $user;
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
@ -2698,7 +2694,6 @@ class Commande extends CommonOrder
*/ */
function update($user=null, $notrigger=0) function update($user=null, $notrigger=0)
{ {
global $conf, $langs;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -3205,7 +3200,7 @@ class Commande extends CommonOrder
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
global $user,$langs,$conf; global $langs;
dol_syslog(get_class($this)."::initAsSpecimen"); dol_syslog(get_class($this)."::initAsSpecimen");
@ -3287,7 +3282,7 @@ class Commande extends CommonOrder
*/ */
function load_state_board() function load_state_board()
{ {
global $conf, $user; global $user;
$this->nb=array(); $this->nb=array();
$clause = "WHERE"; $clause = "WHERE";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
@ -991,6 +991,7 @@ if ($resql)
if (! empty($arrayfields['c.facture']['checked'])) if (! empty($arrayfields['c.facture']['checked']))
{ {
print '<td align="center">'.yn($obj->billed).'</td>'; print '<td align="center">'.yn($obj->billed).'</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Action column // Action column

View File

@ -34,6 +34,7 @@ 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 . '/core/class/html.formbank.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
@ -131,6 +132,10 @@ if ($_POST["action"] == 'add')
$id = $account->create($user); $id = $account->create($user);
if ($id > 0) if ($id > 0)
{ {
// Category association
$categories = GETPOST('categories');
$account->setCategories($categories);
$_GET["id"]=$id; // Force chargement page en mode visu $_GET["id"]=$id; // Force chargement page en mode visu
} }
else { else {
@ -207,6 +212,10 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
$result = $account->update($user); $result = $account->update($user);
if ($result >= 0) if ($result >= 0)
{ {
// Category association
$categories = GETPOST('categories');
$account->setCategories($categories);
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
} }
else else
@ -337,6 +346,20 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Web").'</td>'; print '<tr><td>'.$langs->trans("Web").'</td>';
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>'; print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
// Tags-Categories
if ($conf->categorie->enabled)
{
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
$cats = $c->containing($account->id,Categorie::TYPE_ACCOUNT);
foreach($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>";
}
// Comment // Comment
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
@ -591,6 +614,13 @@ else
if ($account->url) print '</a>'; if ($account->url) print '</a>';
print "</td></tr>\n"; print "</td></tr>\n";
// Categories
if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
print $form->showCategories($account->id,'account',1);
print "</td></tr>";
}
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>'; print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>';
@ -834,6 +864,20 @@ else
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$account->url).'">'; print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$account->url).'">';
print '</td></tr>'; print '</td></tr>';
// Tags-Categories
if ($conf->categorie->enabled)
{
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
foreach($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>";
}
// Comment // Comment
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';

View File

@ -893,6 +893,49 @@ class Account extends CommonObject
} }
} }
/**
* Sets object to supplied categories.
*
* Deletes object from existing categories not supplied.
* Adds it to non existing supplied categories.
* Existing categories are left untouch.
*
* @param int[]|int $categories Category or categories IDs
*/
public function setCategories($categories) {
// Handle single category
if (! is_array($categories)) {
$categories = array($categories);
}
// Get current categories
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$existing = $c->containing($this->id, Categorie::TYPE_ACCOUNT, 'id');
// Diff
if (is_array($existing)) {
$to_del = array_diff($existing, $categories);
$to_add = array_diff($categories, $existing);
} else {
$to_del = array(); // Nothing to delete
$to_add = $categories;
}
// Process
foreach($to_del as $del) {
if ($c->fetch($del) > 0) {
$c->del_type($this, 'account');
}
}
foreach ($to_add as $add) {
if ($c->fetch($add) > 0) {
$c->add_type($this, 'account');
}
}
return;
}
/** /**
* Delete bank account from database * Delete bank account from database

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
@ -734,7 +734,7 @@ class Facture extends CommonInvoice
*/ */
function createFromClone($socid=0) function createFromClone($socid=0)
{ {
global $conf,$user,$langs,$hookmanager; global $user,$hookmanager;
$error=0; $error=0;
@ -849,7 +849,7 @@ class Facture extends CommonInvoice
*/ */
function createFromOrder($object) function createFromOrder($object)
{ {
global $conf,$user,$langs,$hookmanager; global $user,$hookmanager;
$error=0; $error=0;
@ -1289,7 +1289,6 @@ class Facture extends CommonInvoice
*/ */
function update($user=null, $notrigger=0) function update($user=null, $notrigger=0)
{ {
global $conf, $langs;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -1682,7 +1681,6 @@ class Facture extends CommonInvoice
*/ */
function set_paid($user,$close_code='',$close_note='') function set_paid($user,$close_code='',$close_note='')
{ {
global $conf,$langs;
$error=0; $error=0;
if ($this->paye != 1) if ($this->paye != 1)
@ -1740,7 +1738,6 @@ class Facture extends CommonInvoice
*/ */
function set_unpaid($user) function set_unpaid($user)
{ {
global $conf,$langs;
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
@ -1790,9 +1787,6 @@ class Facture extends CommonInvoice
*/ */
function set_canceled($user,$close_code='',$close_note='') function set_canceled($user,$close_code='',$close_note='')
{ {
global $conf,$langs;
$error=0;
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
@ -2463,6 +2457,7 @@ class Facture extends CommonInvoice
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null)
{ {
global $conf,$user;
// Deprecation warning // Deprecation warning
if ($label) { if ($label) {
dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING);
@ -2667,7 +2662,7 @@ class Facture extends CommonInvoice
*/ */
function update_percent($line, $percent) function update_percent($line, $percent)
{ {
global $mysoc; global $mysoc,$user;
include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php');
@ -2693,7 +2688,6 @@ class Facture extends CommonInvoice
*/ */
function deleteline($rowid) function deleteline($rowid)
{ {
global $langs, $conf;
dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG); dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG);
@ -2931,7 +2925,7 @@ class Facture extends CommonInvoice
*/ */
function getNextNumRef($soc,$mode='next') function getNextNumRef($soc,$mode='next')
{ {
global $conf, $db, $langs; global $conf, $langs;
$langs->load("bills"); $langs->load("bills");
// Clean parameters (if not defined or using deprecated value) // Clean parameters (if not defined or using deprecated value)
@ -2993,7 +2987,7 @@ class Facture extends CommonInvoice
* set up mask. * set up mask.
*/ */
if ($mode != 'last' && !$numref) { if ($mode != 'last' && !$numref) {
dol_print_error($db,"Facture::getNextNumRef ".$obj->error); dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error);
return ""; return "";
} }
@ -3307,7 +3301,6 @@ class Facture extends CommonInvoice
*/ */
function demande_prelevement($fuser, $amount=0) function demande_prelevement($fuser, $amount=0)
{ {
global $langs;
$error=0; $error=0;
@ -3527,7 +3520,7 @@ class Facture extends CommonInvoice
*/ */
function initAsSpecimen($option='') function initAsSpecimen($option='')
{ {
global $user,$langs,$conf; global $langs;
$now=dol_now(); $now=dol_now();
$arraynow=dol_getdate($now); $arraynow=dol_getdate($now);
@ -3712,7 +3705,7 @@ class Facture extends CommonInvoice
*/ */
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf,$user,$langs; global $conf,$langs;
$langs->load("bills"); $langs->load("bills");
@ -3812,7 +3805,6 @@ class Facture extends CommonInvoice
*/ */
function setFinal() function setFinal()
{ {
global $conf, $langs, $user;
$this->db->begin(); $this->db->begin();
@ -4276,7 +4268,7 @@ class FactureLigne extends CommonInvoiceLine
*/ */
function update($user='',$notrigger=0) function update($user='',$notrigger=0)
{ {
global $user,$langs,$conf; global $user,$conf;
$error=0; $error=0;
@ -4402,9 +4394,7 @@ class FactureLigne extends CommonInvoiceLine
*/ */
function delete() function delete()
{ {
global $conf,$langs,$user; global $user;
$error=0;
$this->db->begin(); $this->db->begin();

View File

@ -273,7 +273,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
} }
else else
{ {
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoContracts").'</td></tr>'; print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoContracts").'</td></tr>';
} }
print "</table><br>"; print "</table><br>";
$db->free($resql); $db->free($resql);

View File

@ -229,12 +229,13 @@ abstract class CommonObject
public $mode_reglement_id; public $mode_reglement_id;
/** /**
* @var string Payment terms ID * @var int Payment terms ID
* @see setPaymentTerms() * @see setPaymentTerms()
*/ */
public $cond_reglement_id; public $cond_reglement_id;
/** /**
* @deprecated * @var int Payment terms ID
* @deprecated Kept for compatibility
* @see cond_reglement_id; * @see cond_reglement_id;
*/ */
public $cond_reglement; public $cond_reglement;
@ -4250,7 +4251,7 @@ abstract class CommonObject
if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
if (! empty($this->array_options) && !empty($this->array_options["options_$key"])) if (! empty($this->array_options) && isset($this->array_options["options_".$key]))
{ {
// Check parameters // Check parameters
$langs->load('admin'); $langs->load('admin');
@ -4258,7 +4259,7 @@ abstract class CommonObject
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
$target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element); $target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element);
$value=$this->array_options["options_$key"]; $value=$this->array_options["options_".$key];
$attributeType = $extrafields->attribute_type[$key]; $attributeType = $extrafields->attribute_type[$key];
$attributeLabel = $extrafields->attribute_label[$key]; $attributeLabel = $extrafields->attribute_label[$key];
$attributeParam = $extrafields->attribute_param[$key]; $attributeParam = $extrafields->attribute_param[$key];
@ -4272,17 +4273,17 @@ abstract class CommonObject
} }
elseif ($value=='') elseif ($value=='')
{ {
$this->array_options["options_$key"] = null; $this->array_options["options_".$key] = null;
} }
break; break;
case 'price': case 'price':
$this->array_options["options_$key"] = price2num($this->array_options["options_$key"]); $this->array_options["options_".$key] = price2num($this->array_options["options_".$key]);
break; break;
case 'date': case 'date':
$this->array_options["options_$key"]=$this->db->idate($this->array_options["options_$key"]); $this->array_options["options_".$key]=$this->db->idate($this->array_options["options_".$key]);
break; break;
case 'datetime': case 'datetime':
$this->array_options["options_$key"]=$this->db->idate($this->array_options["options_$key"]); $this->array_options["options_".$key]=$this->db->idate($this->array_options["options_".$key]);
break; break;
case 'link': case 'link':
$param_list=array_keys($attributeParam ['options']); $param_list=array_keys($attributeParam ['options']);
@ -4294,13 +4295,13 @@ abstract class CommonObject
if ($value) if ($value)
{ {
$object->fetch(0,$value); $object->fetch(0,$value);
$this->array_options["options_$key"]=$object->id; $this->array_options["options_".$key]=$object->id;
} }
break; break;
} }
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET $key='".$this->db->escape($this->array_options["options_$key"])."'"; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key."='".$this->db->escape($this->array_options["options_".$key])."'";
$sql .= " WHERE fk_object = ".$this->id; $sql .= " WHERE fk_object = ".$this->id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)

View File

@ -39,6 +39,7 @@ class Fiscalyear extends CommonObject
var $label; var $label;
var $date_start; var $date_start;
var $date_end; var $date_end;
var $datec;
var $statut; // 0=open, 1=closed var $statut; // 0=open, 1=closed
var $entity; var $entity;

View File

@ -5250,7 +5250,7 @@ class Form
* *
* @param CommonObject $object Object we want to show links to * @param CommonObject $object Object we want to show links to
* @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order') * @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order')
* @return int <0 if KO, >0 if OK * @return string <0 if KO, >0 if OK
*/ */
function showLinkToObjectBlock($object, $restrictlinksto=array()) function showLinkToObjectBlock($object, $restrictlinksto=array())
{ {
@ -5468,7 +5468,7 @@ class Form
* @param int $option 0 return yes/no, 1 return 1/0 * @param int $option 0 return yes/no, 1 return 1/0
* @param bool $disabled true or false * @param bool $disabled true or false
* @param int $useempty 1=Add empty line * @param int $useempty 1=Add empty line
* @return mixed See option * @return string See option
*/ */
function selectyesno($htmlname,$value='',$option=0,$disabled=false,$useempty='') function selectyesno($htmlname,$value='',$option=0,$disabled=false,$useempty='')
{ {
@ -5810,7 +5810,7 @@ class Form
* @param string $include Array list of groups id to include * @param string $include Array list of groups id to include
* @param int $enableonly Array list of groups id to be enabled. All other must be disabled * @param int $enableonly Array list of groups id to be enabled. All other must be disabled
* @param int $force_entity 0 or Id of environment to force * @param int $force_entity 0 or Id of environment to force
* @return void * @return string
* @see select_dolusers * @see select_dolusers
*/ */
function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0) function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0)

View File

@ -2775,7 +2775,7 @@ function dol_print_error($db='',$error='',$errors=null)
foreach($errors as $msg) foreach($errors as $msg)
{ {
$msg=$langs->trans($msg); if (empty($msg)) continue;
if ($_SERVER['DOCUMENT_ROOT']) // Mode web if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{ {
$out.="<b>".$langs->trans("Message").":</b> ".$msg."<br>\n" ; $out.="<b>".$langs->trans("Message").":</b> ".$msg."<br>\n" ;

View File

@ -259,10 +259,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Bank -- Bank
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&amp;leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&amp;leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__); -- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/virement.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/virement.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
-- Account - Categories
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'cat', 14__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=5', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/categories/card.php?action=create&amp;type=5', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- Project -- Project
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&amp;action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&amp;action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);

View File

@ -1049,14 +1049,19 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank');
$newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); $newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
$newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer);
$newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer); $newmenu->add("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer);
} }
if (! empty($conf->categorie->enabled)) {
$langs->load("categories");
//$newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer);
$newmenu->add("/categories/index.php?type=5",$langs->trans("Rubriques"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags');
$newmenu->add("/categories/card.php?action=create&amp;type=5",$langs->trans("NewCategory"),1,$user->rights->categorie->creer);
}
// Prelevements // Prelevements
if (! empty($conf->prelevement->enabled)) if (! empty($conf->prelevement->enabled))
{ {

View File

@ -52,7 +52,7 @@ class mailing_advthirdparties extends MailingTargets
* *
* @param int $mailing_id Id of mailing. No need to use it. * @param int $mailing_id Id of mailing. No need to use it.
* @param array $socid Array of id soc to add * @param array $socid Array of id soc to add
* @param int $type_of_target define in advtargetemailing.class.php * @param int $type_of_target Defined in advtargetemailing.class.php
* @param array $contactid Array of contact id to add * @param array $contactid Array of contact id to add
* @return int <0 if error, number of emails added if ok * @return int <0 if error, number of emails added if ok
*/ */
@ -73,10 +73,7 @@ class mailing_advthirdparties extends MailingTargets
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND s.rowid IN (".implode(',',$socid).")"; $sql.= " AND s.rowid IN (".implode(',',$socid).")";
$sql.= " ORDER BY email"; $sql.= " ORDER BY email";
}
dol_syslog(get_class($this)."::add_to_target societe sql=".$sql, LOG_DEBUG);
// Stock recipients emails into targets table // Stock recipients emails into targets table
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
@ -116,6 +113,7 @@ class mailing_advthirdparties extends MailingTargets
return -1; return -1;
} }
} }
}
if (($type_of_target==1) || ($type_of_target==2)) { if (($type_of_target==1) || ($type_of_target==2)) {
// Select the third parties from category // Select the third parties from category
@ -131,10 +129,7 @@ class mailing_advthirdparties extends MailingTargets
$sql.= " AND socp.fk_soc IN (".implode(',',$socid).")"; $sql.= " AND socp.fk_soc IN (".implode(',',$socid).")";
} }
$sql.= " ORDER BY email"; $sql.= " ORDER BY email";
}
dol_syslog(get_class($this)."::add_to_target contact sql=".$sql);
// Stock recipients emails into targets table // Stock recipients emails into targets table
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
@ -174,6 +169,7 @@ class mailing_advthirdparties extends MailingTargets
return -1; return -1;
} }
} }
}
dol_syslog(get_class($this)."::add_to_target mailing cibles=".var_export($cibles,true), LOG_DEBUG); dol_syslog(get_class($this)."::add_to_target mailing cibles=".var_export($cibles,true), LOG_DEBUG);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
@ -90,6 +90,7 @@ class Expedition extends CommonObject
var $date_creation; var $date_creation;
var $date_valid; var $date_valid;
var $meths;
var $listmeths; // List of carriers var $listmeths; // List of carriers
/** /**
@ -119,7 +120,7 @@ class Expedition extends CommonObject
*/ */
function getNextNumRef($soc) function getNextNumRef($soc)
{ {
global $db, $langs, $conf; global $langs, $conf;
$langs->load("sendings"); $langs->load("sendings");
if (!empty($conf->global->EXPEDITION_ADDON_NUMBER)) if (!empty($conf->global->EXPEDITION_ADDON_NUMBER))
@ -156,7 +157,7 @@ class Expedition extends CommonObject
} }
else else
{ {
dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
return ""; return "";
} }
} }
@ -176,7 +177,7 @@ class Expedition extends CommonObject
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
global $conf, $langs, $hookmanager; global $conf, $hookmanager;
$now=dol_now(); $now=dol_now();
@ -978,7 +979,7 @@ class Expedition extends CommonObject
*/ */
function update($user=null, $notrigger=0) function update($user=null, $notrigger=0)
{ {
global $conf, $langs; global $conf;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -1532,7 +1533,7 @@ class Expedition extends CommonObject
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
global $user,$langs,$conf; global $langs;
$now=dol_now(); $now=dol_now();
@ -1644,7 +1645,7 @@ class Expedition extends CommonObject
function fetch_delivery_methods() function fetch_delivery_methods()
{ {
global $langs; global $langs;
$meths = array(); $this->meths = array();
$sql = "SELECT em.rowid, em.code, em.libelle"; $sql = "SELECT em.rowid, em.code, em.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
@ -1799,7 +1800,6 @@ class Expedition extends CommonObject
*/ */
function setClosed() function setClosed()
{ {
global $conf;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
@ -1825,7 +1825,6 @@ class Expedition extends CommonObject
*/ */
function set_billed() function set_billed()
{ {
global $conf;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2, billed=1'; // TODO Update only billed $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2, billed=1'; // TODO Update only billed
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
@ -1851,7 +1850,6 @@ class Expedition extends CommonObject
*/ */
function reOpen() function reOpen()
{ {
global $conf;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=1'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=1';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
@ -1882,7 +1880,7 @@ class Expedition extends CommonObject
*/ */
public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0) public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf,$user,$langs; global $conf,$langs;
$langs->load("sendings"); $langs->load("sendings");

View File

@ -35,6 +35,7 @@ ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NO
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx; ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_opensurvey_sondage ADD COLUMN status integer DEFAULT 1 after date_fin;
ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0;
@ -406,6 +407,20 @@ ALTER TABLE llx_product_fournisseur_price ADD supplier_reputation varchar(10) NU
ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price; ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price;
CREATE TABLE llx_categorie_account
(
fk_categorie integer NOT NULL,
fk_account integer NOT NULL,
import_key varchar(14)
) ENGINE=innodb;
ALTER TABLE llx_categorie_account ADD PRIMARY KEY pk_categorie_account (fk_categorie, fk_account);
ALTER TABLE llx_categorie_account ADD INDEX idx_categorie_account_fk_categorie (fk_categorie);
ALTER TABLE llx_categorie_account ADD INDEX idx_categorie_account_fk_account (fk_account);
ALTER TABLE llx_categorie_account ADD CONSTRAINT fk_categorie_account_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_account ADD CONSTRAINT fk_categorie_account_fk_account FOREIGN KEY (fk_account) REFERENCES llx_bank_account (rowid);
-- Delete old deprecated field -- Delete old deprecated field
ALTER TABLE llx_product_stock DROP COLUMN pmp; ALTER TABLE llx_product_stock DROP COLUMN pmp;

View File

@ -0,0 +1,26 @@
-- ============================================================================
-- Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
-- Copyright (C) 2016 Frederic France <frederic.france@free.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ============================================================================
ALTER TABLE llx_categorie_account ADD PRIMARY KEY pk_categorie_account (fk_categorie, fk_account);
ALTER TABLE llx_categorie_account ADD INDEX idx_categorie_account_fk_categorie (fk_categorie);
ALTER TABLE llx_categorie_account ADD INDEX idx_categorie_account_fk_account (fk_account);
ALTER TABLE llx_categorie_account ADD CONSTRAINT fk_categorie_account_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_account ADD CONSTRAINT fk_categorie_account_fk_account FOREIGN KEY (fk_account) REFERENCES llx_bank_account (rowid);

View File

@ -0,0 +1,25 @@
-- ============================================================================
-- Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
-- Copyright (C) 2016 Frederic France <frederic.france@free.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===========================================================================
CREATE TABLE llx_categorie_account
(
fk_categorie integer NOT NULL,
fk_account integer NOT NULL,
import_key varchar(14)
) ENGINE=innodb;

View File

@ -24,6 +24,7 @@ CREATE TABLE llx_opensurvey_sondage (
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
titre TEXT NOT NULL, titre TEXT NOT NULL,
date_fin DATETIME NOT NULL, date_fin DATETIME NOT NULL,
status integer DEFAULT 1,
format VARCHAR(2) NOT NULL, -- 'A' = Text choice (choices are saved into sujet field), 'D' = Date choice (choices are saved into sujet field), 'F' = Form survey format VARCHAR(2) NOT NULL, -- 'A' = Text choice (choices are saved into sujet field), 'D' = Date choice (choices are saved into sujet field), 'F' = Form survey
mailsonde tinyint NOT NULL DEFAULT 0, mailsonde tinyint NOT NULL DEFAULT 0,
allow_comments tinyint NOT NULL DEFAULT 1, allow_comments tinyint NOT NULL DEFAULT 1,

View File

@ -15,6 +15,7 @@ CustomersCategoriesArea=Customers tags/categories area
ThirdPartyCategoriesArea=Third parties tags/categories area ThirdPartyCategoriesArea=Third parties tags/categories area
MembersCategoriesArea=Members tags/categories area MembersCategoriesArea=Members tags/categories area
ContactsCategoriesArea=Contacts tags/categories area ContactsCategoriesArea=Contacts tags/categories area
AccountsCategoriesArea=Accounts tags/categories area
MainCats=Main tags/categories MainCats=Main tags/categories
SubCats=Subcategories SubCats=Subcategories
CatStatistics=Statistics CatStatistics=Statistics
@ -54,6 +55,8 @@ SupplierHasNoCategory=This supplier is not in any tags/categories
CompanyHasNoCategory=This thirdparty is not in any tags/categories CompanyHasNoCategory=This thirdparty is not in any tags/categories
MemberHasNoCategory=This member is not in any tags/categories MemberHasNoCategory=This member is not in any tags/categories
ContactHasNoCategory=This contact is not in any tags/categories ContactHasNoCategory=This contact is not in any tags/categories
ContactHasNoCategory=This contact is not in any tags/categories
AccountHasNoCategory=This account is not in any tags/categories
ClassifyInCategory=Add to tag/category ClassifyInCategory=Add to tag/category
NoneCategory=None NoneCategory=None
NotCategorized=Without tag/category NotCategorized=Without tag/category
@ -81,11 +84,13 @@ CustomersProspectsCategoriesShort=Custo./Prosp. categories
ProductsCategoriesShort=Products tags/categories ProductsCategoriesShort=Products tags/categories
MembersCategoriesShort=Members tags/categories MembersCategoriesShort=Members tags/categories
ContactCategoriesShort=Contacts tags/categories ContactCategoriesShort=Contacts tags/categories
AccountsCategoriesShort=Accounts tags/categories
ThisCategoryHasNoProduct=This category does not contain any product. ThisCategoryHasNoProduct=This category does not contain any product.
ThisCategoryHasNoSupplier=This category does not contain any supplier. ThisCategoryHasNoSupplier=This category does not contain any supplier.
ThisCategoryHasNoCustomer=This category does not contain any customer. ThisCategoryHasNoCustomer=This category does not contain any customer.
ThisCategoryHasNoMember=This category does not contain any member. ThisCategoryHasNoMember=This category does not contain any member.
ThisCategoryHasNoContact=This category does not contain any contact. ThisCategoryHasNoContact=This category does not contain any contact.
ThisCategoryHasNoAccount=This category does not contain any account.
AssignedToCustomer=Assigned to a customer AssignedToCustomer=Assigned to a customer
AssignedToTheCustomer=Assigned to the customer AssignedToTheCustomer=Assigned to the customer
InternalCategory=Internal category InternalCategory=Internal category

View File

@ -169,3 +169,5 @@ AdvTgtDeleteFilter=Delete filter
AdvTgtSaveFilter=Save filter AdvTgtSaveFilter=Save filter
AdvTgtCreateFilter=Create filter AdvTgtCreateFilter=Create filter
AdvTgtOrCreateNewFilter=Name of new filter AdvTgtOrCreateNewFilter=Name of new filter
NoContactWithCategoryFound=No contact/address with a category found
NoContactLinkedToThirdpartieWithCategoryFound=No contact/address with a category found

View File

@ -62,5 +62,5 @@ ErrorOpenSurveyOneChoice=Enter at least one choice
ErrorOpenSurveyDateFormat=Date must have the format YYYY-MM-DD ErrorOpenSurveyDateFormat=Date must have the format YYYY-MM-DD
ErrorInsertingComment=There was an error while inserting your comment ErrorInsertingComment=There was an error while inserting your comment
MoreChoices=Enter more choices for the voters MoreChoices=Enter more choices for the voters
SurveyExpiredInfo=The voting time of this poll has expired. SurveyExpiredInfo=The poll has been closed or voting delay has expired.
EmailSomeoneVoted=%s has filled a line.\nYou can find your poll at the link: \n%s EmailSomeoneVoted=%s has filled a line.\nYou can find your poll at the link: \n%s

View File

@ -325,3 +325,6 @@ ProductVolume=Volume for 1 product
WeightUnits=Weight unit WeightUnits=Weight unit
VolumeUnits=Volume unit VolumeUnits=Volume unit
SizeUnits=Size unit SizeUnits=Size unit
DeleteProductBuyPrice=Delete buying price
ConfirmDeleteProductBuyPrice=Are you sure you want to delete this buying price?

View File

@ -16,7 +16,10 @@ Website=Web site
AddPage=Add page AddPage=Add page
Page=Page Page=Page
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page. PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page.
PageDeleted=Page %s of website %s deleted RequestedPageHasNoContentYet=Requested page with id %s has not content yet or cache file .tpl.php was removed. Edit content of page to solve this.
PageDeleted=Page '%s' of website %s deleted
PageAdded=Page '%s' added
ViewSiteInNewTab=View site in new tab ViewSiteInNewTab=View site in new tab
ViewPageInNewTab=View page in new tab ViewPageInNewTab=View page in new tab
SetAsHomePage=Set as Home page SetAsHomePage=Set as Home page
RealURL=Real URL

View File

@ -35,6 +35,8 @@ if (!$user->rights->opensurvey->read) accessforbidden();
// Initialisation des variables // Initialisation des variables
$action=GETPOST('action'); $action=GETPOST('action');
$cancel=GETPOST('cancel');
$numsondage = ''; $numsondage = '';
if (GETPOST('id')) { if (GETPOST('id')) {
@ -58,6 +60,13 @@ $expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GE
* Actions * Actions
*/ */
$parameters = array('id' => $numsondage);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
if ($cancel) $action='';
// Delete // Delete
if ($action == 'delete_confirm') if ($action == 'delete_confirm')
@ -71,6 +80,20 @@ if ($action == 'delete_confirm')
exit(); exit();
} }
// Close
if ($action == 'close')
{
$object->status = Opensurveysondage::STATUS_CLOSED;
$object->update();
}
// Reopend
if ($action == 'reopen')
{
$object->status = Opensurveysondage::STATUS_VALIDATED;
$object->update();
}
// Update // Update
if ($action == 'update') if ($action == 'update')
{ {
@ -105,7 +128,6 @@ if ($action == 'update')
} }
} }
// Add comment // Add comment
if (GETPOST('ajoutcomment')) if (GETPOST('ajoutcomment'))
{ {
@ -151,6 +173,7 @@ if ($action == 'edit') {
// Security check // Security check
if (!$user->rights->opensurvey->write) accessforbidden(); if (!$user->rights->opensurvey->write) accessforbidden();
} }
}
/* /*
@ -196,7 +219,7 @@ print '<table class="border" width="100%">';
$linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).'">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage'); print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage');
print '</td>'; print '</td>';
@ -219,6 +242,12 @@ if ($action == 'edit')
else print dol_htmlentities($object->titre); else print dol_htmlentities($object->titre);
print '</td></tr>'; print '</td></tr>';
// Status
print '<tr><td>';
print $langs->trans("Status") .'</td><td colspan="2">';
print $object->getLibStatut(4);
print '</td></tr>';
// Description // Description
print '<tr><td class="tdtop">'.$langs->trans("Description") .'</td><td colspan="2">'; print '<tr><td class="tdtop">'.$langs->trans("Description") .'</td><td colspan="2">';
if ($action == 'edit') if ($action == 'edit')
@ -326,7 +355,11 @@ dol_fiche_end();
if ($action == 'edit') if ($action == 'edit')
{ {
print '<div class="center"><input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>'; print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
} }
print '</form>'."\n"; print '</form>'."\n";
@ -343,6 +376,17 @@ if ($action != 'edit' && $user->rights->opensurvey->write) {
//Modify button //Modify button
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondage . '">'.$langs->trans("Modify") . '</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondage . '">'.$langs->trans("Modify") . '</a>';
if ($object->status == Opensurveysondage::STATUS_VALIDATED)
{
//Close button
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=close&id=' . $numsondage . '">'.$langs->trans("Close") . '</a>';
}
if ($object->status == Opensurveysondage::STATUS_CLOSED)
{
//Opened button
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=reopen&id=' . $numsondage . '">'.$langs->trans("ReOpen") . '</a>';
}
//Delete button //Delete button
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&id='.$numsondage.'&amp;action=delete">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&id='.$numsondage.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
} }

View File

@ -56,6 +56,7 @@ class Opensurveysondage extends CommonObject
var $titre; var $titre;
var $date_fin=''; var $date_fin='';
var $status=1;
var $format; var $format;
var $mailsonde; var $mailsonde;
@ -73,6 +74,22 @@ class Opensurveysondage extends CommonObject
*/ */
public $allow_spy; public $allow_spy;
/**
* Draft status (not used)
*/
const STATUS_DRAFT = 0;
/**
* Validated/Opened status
*/
const STATUS_VALIDATED = 1;
/**
* Closed
*/
const STATUS_CLOSED = 2;
/** /**
* Constructor * Constructor
* *
@ -115,6 +132,7 @@ class Opensurveysondage extends CommonObject
$sql.= "fk_user_creat,"; $sql.= "fk_user_creat,";
$sql.= "titre,"; $sql.= "titre,";
$sql.= "date_fin,"; $sql.= "date_fin,";
$sql.= "status,";
$sql.= "format,"; $sql.= "format,";
$sql.= "mailsonde,"; $sql.= "mailsonde,";
$sql.= "allow_comments,"; $sql.= "allow_comments,";
@ -127,6 +145,7 @@ class Opensurveysondage extends CommonObject
$sql.= " ".$user->id.","; $sql.= " ".$user->id.",";
$sql.= " '".$this->db->escape($this->titre)."',"; $sql.= " '".$this->db->escape($this->titre)."',";
$sql.= " '".$this->db->idate($this->date_fin)."',"; $sql.= " '".$this->db->idate($this->date_fin)."',";
$sql.= " ".$this->status.",";
$sql.= " '".$this->db->escape($this->format)."',"; $sql.= " '".$this->db->escape($this->format)."',";
$sql.= " ".$this->db->escape($this->mailsonde).","; $sql.= " ".$this->db->escape($this->mailsonde).",";
$sql.= " ".$this->db->escape($this->allow_comments).","; $sql.= " ".$this->db->escape($this->allow_comments).",";
@ -190,6 +209,7 @@ class Opensurveysondage extends CommonObject
$sql.= " t.fk_user_creat,"; $sql.= " t.fk_user_creat,";
$sql.= " t.titre,"; $sql.= " t.titre,";
$sql.= " t.date_fin,"; $sql.= " t.date_fin,";
$sql.= " t.status,";
$sql.= " t.format,"; $sql.= " t.format,";
$sql.= " t.mailsonde,"; $sql.= " t.mailsonde,";
$sql.= " t.allow_comments,"; $sql.= " t.allow_comments,";
@ -217,6 +237,7 @@ class Opensurveysondage extends CommonObject
$this->nom_admin = $obj->nom_admin; $this->nom_admin = $obj->nom_admin;
$this->titre = $obj->titre; $this->titre = $obj->titre;
$this->date_fin = $this->db->jdate($obj->date_fin); $this->date_fin = $this->db->jdate($obj->date_fin);
$this->status = $obj->status;
$this->format = $obj->format; $this->format = $obj->format;
$this->mailsonde = $obj->mailsonde; $this->mailsonde = $obj->mailsonde;
$this->allow_comments = $obj->allow_comments; $this->allow_comments = $obj->allow_comments;
@ -274,6 +295,7 @@ class Opensurveysondage extends CommonObject
$sql.= " nom_admin=".(isset($this->nom_admin)?"'".$this->db->escape($this->nom_admin)."'":"null").","; $sql.= " nom_admin=".(isset($this->nom_admin)?"'".$this->db->escape($this->nom_admin)."'":"null").",";
$sql.= " titre=".(isset($this->titre)?"'".$this->db->escape($this->titre)."'":"null").","; $sql.= " titre=".(isset($this->titre)?"'".$this->db->escape($this->titre)."'":"null").",";
$sql.= " date_fin=".(dol_strlen($this->date_fin)!=0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').","; $sql.= " date_fin=".(dol_strlen($this->date_fin)!=0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').",";
$sql.= " status=".(isset($this->status)?"'".$this->db->escape($this->status)."'":"null").",";
$sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").","; $sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").",";
$sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").","; $sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").",";
$sql.= " allow_comments=".$this->db->escape($this->allow_comments).","; $sql.= " allow_comments=".$this->db->escape($this->allow_comments).",";
@ -291,15 +313,12 @@ class Opensurveysondage extends CommonObject
{ {
if (! $notrigger) if (! $notrigger)
{ {
// Uncomment this and change MYOBJECT to your own tag if you // Call triggers
// want this action calls a trigger. include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
//// Call triggers $result=$interface->run_triggers('OPENSURVEY_MODIFY',$this,$user,$langs,$conf);
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; if ($result < 0) { $error++; $this->errors=$interface->errors; }
//$interface=new Interfaces($this->db); // End call triggers
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
} }
} }
@ -321,7 +340,6 @@ class Opensurveysondage extends CommonObject
} }
} }
/** /**
* Delete object in database * Delete object in database
* *
@ -428,12 +446,13 @@ class Opensurveysondage extends CommonObject
$this->id=0; $this->id=0;
$this->id_sondage=''; $this->id_sondage='';
$this->commentaires=''; $this->commentaires='Comment of the specimen survey';
$this->mail_admin=''; $this->mail_admin='';
$this->nom_admin=''; $this->nom_admin='';
$this->titre=''; $this->titre='This is a specimen survey';
$this->date_fin=''; $this->date_fin=dol_now()+3600*24*10;
$this->format=''; $this->status=1;
$this->format='classic';
$this->mailsonde=''; $this->mailsonde='';
} }
@ -518,10 +537,74 @@ class Opensurveysondage extends CommonObject
$this->mail_admin = trim($this->mail_admin); $this->mail_admin = trim($this->mail_admin);
$this->nom_admin = trim($this->nom_admin); $this->nom_admin = trim($this->nom_admin);
$this->titre = trim($this->titre); $this->titre = trim($this->titre);
$this->status = trim($this->status);
$this->format = trim($this->format); $this->format = trim($this->format);
$this->mailsonde = ($this->mailsonde ? 1 : 0); $this->mailsonde = ($this->mailsonde ? 1 : 0);
$this->allow_comments = ($this->allow_comments ? 1 : 0); $this->allow_comments = ($this->allow_comments ? 1 : 0);
$this->allow_spy = ($this->allow_spy ? 1 : 0); $this->allow_spy = ($this->allow_spy ? 1 : 0);
$this->sujet = trim($this->sujet); $this->sujet = trim($this->sujet);
} }
/**
* Return status label of Order
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
*/
function getLibStatut($mode)
{
return $this->LibStatut($this->status,$mode);
}
/**
* Return label of status
*
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function LibStatut($status,$mode)
{
global $langs, $conf;
//print 'x'.$status.'-'.$billed;
if ($mode == 0)
{
if ($status==self::STATUS_DRAFT) return $langs->trans('Draft');
if ($status==self::STATUS_VALIDATED) return $langs->trans('Opened');
if ($status==self::STATUS_CLOSED) return $langs->trans('Closed');
}
elseif ($mode == 1)
{
if ($status==self::STATUS_DRAFT) return $langs->trans('Draft');
if ($status==self::STATUS_VALIDATED) return $langs->trans('Opened');
if ($status==self::STATUS_CLOSED) return $langs->trans('Closed');
}
elseif ($mode == 2)
{
if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft');
if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'),'statut1').' '.$langs->trans('Opened');
if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'),'statut6').' '.$langs->trans('Closed');
}
elseif ($mode == 3)
{
if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'),'statut0');
if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'),'statut1');
if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'),'statut6');
}
elseif ($mode == 4)
{
if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft');
if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened').$billedtext,'statut1').' '.$langs->trans('Opened');
if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'),'statut6').' '.$langs->trans('Closed');
}
elseif ($mode == 5)
{
if ($status==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('Draft').' </span>'.img_picto($langs->trans('Draft'),'statut0');
if ($status==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('Opened').' </span>'.img_picto($langs->trans('Opened'),'statut1');
if ($status==self::STATUS_CLOSED) return '<span class="hideonsmartphone">'.$langs->trans('Closed').' </span>'.img_picto($langs->trans('Closed'),'statut6');
}
}
} }

View File

@ -25,6 +25,7 @@
require_once('../main.inc.php'); 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."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php");
// Security check // Security check
if (!$user->rights->opensurvey->read) accessforbidden(); if (!$user->rights->opensurvey->read) accessforbidden();
@ -68,6 +69,7 @@ if (GETPOST('button_removefilter'))
*/ */
$form=new Form($db); $form=new Form($db);
$opensurvey_static = new Opensurveysondage($db);
$now = dol_now(); $now = dol_now();
@ -96,6 +98,7 @@ print_liste_field_titre($langs->trans("Type"));
print_liste_field_titre($langs->trans("Author"), $_SERVER["PHP_SELF"], "u.".$fieldtosortuser,$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Author"), $_SERVER["PHP_SELF"], "u.".$fieldtosortuser,$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("NbOfVoters")); print_liste_field_titre($langs->trans("NbOfVoters"));
print_liste_field_titre($langs->trans("ExpireDate"), $_SERVER["PHP_SELF"], "p.date_fin",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpireDate"), $_SERVER["PHP_SELF"], "p.date_fin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "p.status",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
print '</tr>'."\n"; print '</tr>'."\n";
@ -107,13 +110,14 @@ print '<td></td>';
print '<td></td>'; print '<td></td>';
$arraystatus=array(''=>'&nbsp;','expired'=>$langs->trans("Expired"),'opened'=>$langs->trans("Opened")); $arraystatus=array(''=>'&nbsp;','expired'=>$langs->trans("Expired"),'opened'=>$langs->trans("Opened"));
print '<td align="center">'. $form->selectarray('status', $arraystatus, $status).'</td>'; print '<td align="center">'. $form->selectarray('status', $arraystatus, $status).'</td>';
print '<td></td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0); $searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco; print $searchpitco;
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
$sql = "SELECT p.id_sondage, p.fk_user_creat, p.format, p.date_fin, p.titre, p.nom_admin,"; $sql = "SELECT p.id_sondage, p.fk_user_creat, p.format, p.date_fin, p.status, p.titre, p.nom_admin,";
$sql.= " u.login, u.firstname, u.lastname"; $sql.= " u.login, u.firstname, u.lastname";
$sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p";
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat"; $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat";
@ -150,6 +154,9 @@ while ($i < min($num,$limit))
} }
else dol_print_error($db); else dol_print_error($db);
$opensurvey_static->id=$obj->id_sondage;
$opensurvey_static->status=$obj->status;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
@ -181,6 +188,8 @@ while ($i < min($num,$limit))
if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; } if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; }
print '</td>'; print '</td>';
print'<td align="center">'.$opensurvey_static->getLibStatut(5).'</td>'."\n";
print'<td align="center"></td>'."\n"; print'<td align="center"></td>'."\n";
print '</tr>'."\n"; print '</tr>'."\n";

View File

@ -432,7 +432,7 @@ print '<table class="border" width="100%">';
$linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage'); print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage');
print '</td>'; print '</td>';

View File

@ -3041,6 +3041,7 @@ class Product extends CommonObject
function get_sousproduits_arbo() function get_sousproduits_arbo()
{ {
//$parent = $this->getParent(); //$parent = $this->getParent();
$parent=array();
$parent[$this->label]=array(0 => $this->id); $parent[$this->label]=array(0 => $this->id);
foreach($parent as $key => $value) // key=label, value[0]=id foreach($parent as $key => $value) // key=label, value[0]=id

View File

@ -115,7 +115,7 @@ if (empty($reshook))
} }
} }
if ($action == 'remove_pf') if ($action == 'confirm_remove_pf')
{ {
if ($rowid) // id of product supplier price to remove if ($rowid) // id of product supplier price to remove
{ {
@ -285,6 +285,12 @@ if ($id > 0 || $ref)
if ($result) if ($result)
{ {
if ($action == 'ask_remove_pf') {
$form = new Form($db);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id . '&rowid=' . $rowid, $langs->trans('DeleteProductBuyPrice'), $langs->trans('ConfirmDeleteProductBuyPrice'), 'confirm_remove_pf', '', 0, 1);
echo $formconfirm;
}
if ($action <> 'edit' && $action <> 're-edit') if ($action <> 'edit' && $action <> 're-edit')
{ {
$head=product_prepare_head($object); $head=product_prepare_head($object);
@ -680,7 +686,7 @@ if ($id > 0 || $ref)
if ($user->rights->produit->creer || $user->rights->service->creer) if ($user->rights->produit->creer || $user->rights->service->creer)
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=add_price&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_edit()."</a>"; print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=add_price&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_edit()."</a>";
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=remove_pf&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_picto($langs->trans("Remove"),'disable.png').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=ask_remove_pf&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_picto($langs->trans("Remove"),'disable.png').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -46,7 +46,7 @@ if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage);
$nblignes=$object->fetch_lines(); $nblignes=$object->fetch_lines();
//If the survey has not yet finished, then it can be modified //If the survey has not yet finished, then it can be modified
$canbemodified = (empty($object->date_fin) || $object->date_fin > dol_now()); $canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED);
/* /*

View File

@ -48,8 +48,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error=0; $error=0;
$website=GETPOST('website', 'alpha'); $website=GETPOST('website', 'alpha');
$page=GETPOST('page', 'alpha'); $pageid=GETPOST('page', 'alpha')?GETPOST('page', 'alpha'):GETPOST('pageid', 'alpha');
$pageid=GETPOST('pageid', 'alpha');
$accessallowed = 1; $accessallowed = 1;
$type=''; $type='';
@ -81,13 +80,23 @@ if (empty($pageid))
$pageid=$firstrep->id; $pageid=$firstrep->id;
} }
} }
if (empty($pageid))
{
$langs->load("website");
print $langs->trans("PreviewOfSiteNotYetAvailable");
exit;
}
// Security: Delete string ../ into $original_file // Security: Delete string ../ into $original_file
global $dolibarr_main_data_root; global $dolibarr_main_data_root;
if ($pageid == 'css') if ($pageid == 'css')
{ {
header('Content-type: text/css');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
//else
header('Cache-Control: no-cache');
$original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css'; $original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css';
} }
else else
@ -127,7 +136,9 @@ $original_file_osencoded=dol_osencode($original_file); // New file name encoded
// This test if file exists should be useless. We keep it to find bug more easily // This test if file exists should be useless. We keep it to find bug more easily
if (! file_exists($original_file_osencoded)) if (! file_exists($original_file_osencoded))
{ {
dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file)); $langs->load("website");
print $langs->trans("RequestedPageHasNoContentYet", $pageid);
//dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
exit; exit;
} }

View File

@ -23,8 +23,7 @@
*/ */
/** /**
* \class ActionsCardCommon * Classe permettant la gestion des tiers par defaut
* \brief Classe permettant la gestion des tiers par defaut
*/ */
abstract class ActionsCardCommon abstract class ActionsCardCommon
{ {

View File

@ -370,7 +370,7 @@ class ThirdpartyApi extends DolibarrApi
* Delete thirdparty * Delete thirdparty
* *
* @param int $id Thirparty ID * @param int $id Thirparty ID
* @return type * @return integer
* *
* @url DELETE thirdparty/{id} * @url DELETE thirdparty/{id}
* @url DELETE customer/{id} * @url DELETE customer/{id}

View File

@ -212,6 +212,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_town=""; $search_town="";
$search_zip=""; $search_zip="";
$search_state=""; $search_state="";
$search_country='';
$search_idprof1=''; $search_idprof1='';
$search_idprof2=''; $search_idprof2='';
$search_idprof3=''; $search_idprof3='';
@ -219,7 +220,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_idprof5=''; $search_idprof5='';
$search_idprof6=''; $search_idprof6='';
$search_type=''; $search_type='';
$search_country='';
$search_type_thirdparty=''; $search_type_thirdparty='';
$search_status=''; $search_status='';
$search_stcomm=''; $search_stcomm='';
@ -384,6 +384,7 @@ if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fourniss
if ($search_town) $sql.= natural_search("s.town",$search_town); if ($search_town) $sql.= natural_search("s.town",$search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state); if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_idprof1) $sql.= natural_search("s.siren",$search_idprof1); if ($search_idprof1) $sql.= natural_search("s.siren",$search_idprof1);
if ($search_idprof2) $sql.= natural_search("s.siret",$search_idprof2); if ($search_idprof2) $sql.= natural_search("s.siret",$search_idprof2);
if ($search_idprof3) $sql.= natural_search("s.ape",$search_idprof3); if ($search_idprof3) $sql.= natural_search("s.ape",$search_idprof3);
@ -396,7 +397,6 @@ if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'"; if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'";
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2); if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);

View File

@ -54,15 +54,36 @@ class Website extends CommonObject
public $lines = array(); public $lines = array();
/** /**
* @var int
*/ */
public $entity; public $entity;
/**
* @var string
*/
public $ref; public $ref;
/**
* @var string
*/
public $description; public $description;
/**
* @var int
*/
public $status; public $status;
public $date_creation = ''; /**
public $date_modification = ''; * @var mixed
*/
public $date_creation;
/**
* @var mixed
*/
public $date_modification;
/**
* @var mixed
*/
public $tms = ''; public $tms = '';
/**
* @var integer
*/
public $fk_default_home; public $fk_default_home;
public $records; public $records;
@ -625,20 +646,36 @@ class WebsiteLine
*/ */
public $id; public $id;
/** /**
* @var mixed Sample line property 1 * @var int
*/ */
public $entity; public $entity;
/**
* @var string
*/
public $ref; public $ref;
/**
* @var string
*/
public $description; public $description;
/**
* @var int
*/
public $status; public $status;
/**
* @var int
*/
public $fk_default_home; public $fk_default_home;
public $date_creation = ''; /**
public $date_modification = ''; * @var mixed
*/
public $date_creation;
/**
* @var mixed
*/
public $date_modification;
/**
* @var mixed
*/
public $tms = ''; public $tms = '';
/**
* @var mixed Sample line property 2
*/
} }

View File

@ -253,6 +253,7 @@ class WebsitePage extends CommonObject
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
* @param string $websiteid Web site
* @param string $sortorder Sort Order * @param string $sortorder Sort Order
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit limit * @param int $limit limit
@ -261,7 +262,7 @@ class WebsitePage extends CommonObject
* @param string $filtermode Filter mode (AND or OR) * @param string $filtermode Filter mode (AND or OR)
* @return array|int int <0 if KO, array of pages if OK * @return array|int int <0 if KO, array of pages if OK
*/ */
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND') public function fetchAll($websiteid, $sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
{ {
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -280,6 +281,7 @@ class WebsitePage extends CommonObject
$sql .= " t.date_modification,"; $sql .= " t.date_modification,";
$sql .= " t.tms"; $sql .= " t.tms";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE t.fk_website = '.$websiteid;
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
if (count($filter) > 0) { if (count($filter) > 0) {

View File

@ -126,6 +126,11 @@ $pathofwebsite=$dolibarr_main_data_root.'/websites/'.$website;
$filecss=$pathofwebsite.'/styles.css'; $filecss=$pathofwebsite.'/styles.css';
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php'; $filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
// 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
/* /*
@ -162,7 +167,7 @@ if ($action == 'add')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("PageAdded"), null, 'mesgs'); setEventMessages($langs->trans("PageAdded", $objectpage->pageurl), null, 'mesgs');
$action=''; $action='';
} }
else else
@ -475,6 +480,9 @@ if (count($object->records) > 0)
if ($website) if ($website)
{ {
print ' - '.$langs->trans("RealURL").' ';
$realurl=$urlwithroot.'/public/websites/index.php?website='.$website;
print '<input type="text" name="realurl" value="'.$realurl.'"> ';
print '<a href="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'">'.$langs->trans("ViewSiteInNewTab").'</a>'; print '<a href="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'">'.$langs->trans("ViewSiteInNewTab").'</a>';
} }
print '</div>'; print '</div>';
@ -508,7 +516,9 @@ if (count($object->records) > 0)
{ {
print '</div>'; print '</div>';
$array=$objectpage->fetchAll('','',0,0,array('t.fk_website'=>$object->id)); $array=$objectpage->fetchAll($object->id);
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">'; print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
print '<div class="websiteselection">'; print '<div class="websiteselection">';
@ -517,7 +527,7 @@ if (count($object->records) > 0)
print '<div class="websiteselection">'; print '<div class="websiteselection">';
$out=''; $out='';
$out.='<select name="pageid">'; $out.='<select name="pageid">';
if (is_array($array) && count($array) > 0) if ($atleastonepage)
{ {
foreach($array as $key => $valpage) foreach($array as $key => $valpage)
{ {
@ -534,13 +544,16 @@ if (count($object->records) > 0)
else $out.='<option value="-1">&nbsp;</option>'; else $out.='<option value="-1">&nbsp;</option>';
$out.='</select>'; $out.='</select>';
print $out; print $out;
print '<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">'; print '<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'"'.($atleastonepage?'':' disabled="disabled"').'>';
print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'">'; print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage?'':' disabled="disabled"').'>';
//print $form->selectarray('page', $array); //print $form->selectarray('page', $array);
if ($website && $pageid > 0) if ($website && $pageid > 0)
{ {
print '<a href="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'&page='.$pageid.'" target="tab'.$website.'">'.$langs->trans("ViewPageInNewTab").'</a>'; print ' - '.$langs->trans("RealURL").' ';
$realurl=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid;
print '<input type="text" name="realurl" value="'.$realurl.'"> ';
print '<a href="'.$realurl.'" target="tab'.$website.'">'.$langs->trans("ViewPageInNewTab").'</a>';
} }
print '</div>'; print '</div>';