merge develop

This commit is contained in:
Florian HENRY 2020-12-28 21:15:25 +01:00
commit 806b40662f
71 changed files with 1307 additions and 684 deletions

View File

@ -50,7 +50,7 @@ jobs:
- if: type = push AND branch = develop
php: nightly
env: DB=mysql
- if: type = push AND branch = 13.0
- if: type = push AND branch = 14.0
php: nightly
env: DB=mysql
@ -401,6 +401,9 @@ script:
php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log
php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log
php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log
php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log
php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log
# Enable modules not enabled into original dump
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP > $TRAVIS_BUILD_DIR/enablemodule.log

View File

@ -182,8 +182,8 @@ NEW: Add option "If the feature to manage kits of module Stock is used, show det
For developers:
---------------
NEW: add __MEMBER_TYPE__ substitution key
NEW: add __TYPE__ substitution key
NEW: add substitution key __MEMBER_TYPE__
NEW: add substitution key __TYPE__
NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup
NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: Add some fields to link website page to an other object
@ -193,14 +193,9 @@ NEW: can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
NEW: can force the antivirus from conf file or autoprepend ini setup
NEW: can add event to log into blockedlog module with a constant
NEW: add property cssview when declaring fields of an object
NEW: Can use dynamic code into the 'enabled' property of DAO fields
NEW: allow to edit "demand reason" field though API
NEW: fetch contact by email with REST API
NEW: can use dynamic code into the 'enabled' property of DAO fields
NEW: field ref_ext in llx_commandedet
NEW: fields ref_ext for Attributes and Combinations
NEW: get state by REST API
NEW: get state dictionnary by REST API
NEW: improve Product API for variant products
NEW: field ref_ext for Attributes and Combinations
NEW: OAuth SCOPE for Admin SDK
NEW: retrieve discount from invoice from API
NEW: standardizes API thirdparties by email like other object
@ -221,6 +216,11 @@ NEW: API can update a payment
NEW: API get member by thirdparty
NEW: API get thirdparty by barcode
NEW: API get users by email / login
NEW: allow to edit field "demand reason" through API
NEW: fetch contact by email with REST API
NEW: get state by REST API
NEW: get state dictionary by REST API
NEW: improve Product API for product variants
HOOKs
NEW: Hook on propal card

View File

@ -50,6 +50,13 @@ Replace call to serialize_val with no bugged value
* In all files, replace constructor names into __construct. Replace also parent::constructor_name with parent::__construct
* Line 4222 of file nusoap.php
$rev = array();
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
TCPDF:

View File

@ -314,7 +314,6 @@ if ($action != 'export_csv')
if (empty($accountingaccountstatic->account_number)) {
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>';
}
print '<tr class="oddeven">';
if (!empty($show_subgroup))
{
@ -343,6 +342,7 @@ if ($action != 'export_csv')
}
}
print '<tr class="oddeven">';
print '<td>'.$accounting_account.'</td>';
print '<td class="nowraponall right">'.price($opening_balance).'</td>';
print '<td class="nowraponall right">'.price($line->debit).'</td>';

View File

@ -937,6 +937,11 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'bank')
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$objectstatic = new AccountLine($db);
$objectstatic->fetch($line->fk_doc);
} else {
// Other type
}
@ -951,6 +956,10 @@ while ($i < min($num, $limit))
{
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else {
print $line->doc_ref;
}

View File

@ -667,6 +667,11 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'bank')
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$objectstatic = new AccountLine($db);
$objectstatic->fetch($line->fk_doc);
} else {
// Other type
}
@ -681,6 +686,10 @@ while ($i < min($num, $limit))
{
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else {
print $line->doc_ref;
}

View File

@ -679,6 +679,11 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'bank')
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$objectstatic = new AccountLine($db);
$objectstatic->fetch($line->fk_doc);
} else {
// Other type
}
@ -693,6 +698,10 @@ while ($i < min($num, $limit))
{
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else {
print $line->doc_ref;
}

View File

@ -1064,7 +1064,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border centpercent">';
// Ref
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur">'.$object->id.'</td></tr>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur">'.$object->ref.'</td></tr>';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {

View File

@ -63,19 +63,24 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
$arrayofmembers = array();
// request taking into account member with up to date subscriptions
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql = "SELECT d.rowid, d.ref, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql .= " t.libelle as type,";
$sql .= " c.code as country_code, c.label as country";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label']))
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
}
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
}
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql .= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid;
if (is_numeric($foruserid)) $sql .= " AND d.rowid=".(int) $foruserid;
if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
$sql .= " ORDER BY d.rowid ASC";
@ -90,6 +95,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
if ($objp->country == '-') $objp->country = '';
$adherentstatic->id = $objp->rowid;
$adherentstatic->ref = $objp->ref;
$adherentstatic->lastname = $objp->lastname;
$adherentstatic->firstname = $objp->firstname;
@ -110,6 +116,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
// List of values to scan for a replacement
$substitutionarray = array(
'__ID__'=>$objp->rowid,
'__REF__'=>$objp->ref,
'__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname,
'__LASTNAME__'=>$objp->lastname,
@ -149,6 +156,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'ref'=>$objp->ref,
'photo'=>$objp->photo
);
}
@ -159,6 +167,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'ref'=>$objp->ref,
'photo'=>$objp->photo
);
}
@ -172,12 +181,15 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
$textfooter = '';
$textright = '';
$arrayofmembers[] = array('textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'photo'=>$objp->photo);
$arrayofmembers[] = array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'ref'=>$objp->ref,
'photo'=>$objp->photo,
);
}
$i++;

View File

@ -288,6 +288,7 @@ class Adherent extends CommonObject
*/
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10),
'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => 1, 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 12, 'index' => 1),
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20),
'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25),
@ -417,6 +418,7 @@ class Adherent extends CommonObject
$infos = '';
if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n";
$infos .= $langs->transnoentities("id").": ".$this->id."\n";
$infos .= $langs->transnoentities("ref").": ".$this->ref."\n";
$infos .= $langs->transnoentities("Lastname").": ".$this->lastname."\n";
$infos .= $langs->transnoentities("Firstname").": ".$this->firstname."\n";
$infos .= $langs->transnoentities("Company").": ".$this->company."\n";
@ -438,15 +440,20 @@ class Adherent extends CommonObject
// Substitutions
$substitutionarray = array(
'__ID__' => $this->id, '__MEMBER_ID__' => $this->id, '__CIVILITY__' => $this->getCivilityLabel(),
'__ID__' => $this->id,
'__REF__' => $this->ref,
'__MEMBER_ID__' => $this->id,
'__CIVILITY__' => $this->getCivilityLabel(),
'__FIRSTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->firstname) : ($this->firstname ? $this->firstname : ''),
'__LASTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->lastname) : ($this->lastname ? $this->lastname : ''),
'__FULLNAME__' => $msgishtml ? dol_htmlentitiesbr($this->getFullName($langs)) : $this->getFullName($langs),
'__COMPANY__' => $msgishtml ? dol_htmlentitiesbr($this->company) : ($this->company ? $this->company : ''),
'__ADDRESS__' => $msgishtml ? dol_htmlentitiesbr($this->address) : ($this->address ? $this->address : ''),
'__ZIP__' => $msgishtml ? dol_htmlentitiesbr($this->zip) : ($this->zip ? $this->zip : ''), '__TOWN__' => $msgishtml ? dol_htmlentitiesbr($this->town) : ($this->town ? $this->town : ''),
'__ZIP__' => $msgishtml ? dol_htmlentitiesbr($this->zip) : ($this->zip ? $this->zip : ''),
'__TOWN__' => $msgishtml ? dol_htmlentitiesbr($this->town) : ($this->town ? $this->town : ''),
'__COUNTRY__' => $msgishtml ? dol_htmlentitiesbr($this->country) : ($this->country ? $this->country : ''),
'__EMAIL__' => $msgishtml ? dol_htmlentitiesbr($this->email) : ($this->email ? $this->email : ''), '__BIRTH__' => $msgishtml ? dol_htmlentitiesbr($birthday) : ($birthday ? $birthday : ''),
'__EMAIL__' => $msgishtml ? dol_htmlentitiesbr($this->email) : ($this->email ? $this->email : ''),
'__BIRTH__' => $msgishtml ? dol_htmlentitiesbr($birthday) : ($birthday ? $birthday : ''),
'__PHOTO__' => $msgishtml ? dol_htmlentitiesbr($this->photo) : ($this->photo ? $this->photo : ''),
'__LOGIN__' => $msgishtml ? dol_htmlentitiesbr($this->login) : ($this->login ? $this->login : ''),
'__PASSWORD__' => $msgishtml ? dol_htmlentitiesbr($this->pass) : ($this->pass ? $this->pass : ''),
@ -519,9 +526,10 @@ class Adherent extends CommonObject
// Insert member
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent";
$sql .= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)";
$sql .= " (ref, datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)";
$sql .= " VALUES (";
$sql .= " '".$this->db->idate($this->datec)."'";
$sql .= " '(PROV)'";
$sql .= ", '".$this->db->idate($this->datec)."'";
$sql .= ", ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
$sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
$sql .= ", null, null, '".$this->db->escape($this->morphy)."'";
@ -635,7 +643,8 @@ class Adherent extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql .= " civility = ".($this->civility_id ? "'".$this->db->escape($this->civility_id)."'" : "null");
$sql .= " ref = '".$this->db->escape($this->ref)."'";
$sql .= ", civility = ".($this->civility_id ? "'".$this->db->escape($this->civility_id)."'" : "null");
$sql .= ", firstname = ".($this->firstname ? "'".$this->db->escape($this->firstname)."'" : "null");
$sql .= ", lastname = ".($this->lastname ? "'".$this->db->escape($this->lastname)."'" : "null");
$sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
@ -752,6 +761,7 @@ class Adherent extends CommonObject
// If option ADHERENT_LOGIN_NOT_REQUIRED is on, there is no login of member, so we do not overwrite user login to keep existing one.
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $luser->login = $this->login;
$luser->ref = $this->ref;
$luser->civility_id = $this->civility_id;
$luser->firstname = $this->firstname;
$luser->lastname = $this->lastname;
@ -1242,7 +1252,8 @@ class Adherent extends CommonObject
{
global $langs;
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql = "SELECT d.rowid, d.ref, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname,";
$sql .= " d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql .= " d.note_public,";
$sql .= " d.email, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
$sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
@ -1268,7 +1279,7 @@ class Adherent extends CommonObject
} elseif ($ref || $fk_soc) {
$sql .= " AND d.entity IN (".getEntity('adherent').")";
if ($ref) {
$sql .= " AND d.rowid='".$this->db->escape($ref)."'";
$sql .= " AND d.ref='".$this->db->escape($ref)."'";
} elseif ($fk_soc > 0) {
$sql .= " AND d.fk_soc=".((int) $fk_soc);
}
@ -1283,8 +1294,8 @@ class Adherent extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->entity = $obj->entity;
$this->ref = $obj->rowid;
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility
@ -2072,7 +2083,7 @@ class Adherent extends CommonObject
if ($mode == 'login') {
$result .= dol_trunc($this->login, $maxlen);
} elseif ($mode == 'ref') {
$result .= $this->id;
$result .= $this->ref;
} else {
$result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen);
}
@ -2317,6 +2328,7 @@ class Adherent extends CommonObject
// Initialise parametres
$this->id = 0;
$this->ref = 'ABC001';
$this->entity = 1;
$this->specimen = 1;
$this->civility_id = 0;

View File

@ -101,7 +101,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'd.rowid'=>'Ref',
'd.ref'=>'Ref',
'd.login'=>'Login',
'd.lastname'=>'Lastname',
'd.firstname'=>'Firstname',
@ -247,7 +247,7 @@ $memberstatic = new Adherent($db);
$now = dol_now();
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
$sql = "SELECT d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
$sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
@ -264,8 +264,13 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_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 (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
}
if (!empty($search_categ) || !empty($catid)) {
// We need this table joined to the select in order to filter by categ
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member";
}
$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 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
@ -281,10 +286,12 @@ if ($search_type > 0) $sql .= " AND t.rowid=".$db->escape($search_type);
if ($search_filter == 'withoutsubscription') $sql .= " AND (datefin IS NULL OR t.subscription = 0)";
if ($search_filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
if ($search_filter == 'outofdate') $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
if ($search_status != '') $sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_status != '') {
// Peut valoir un nombre ou liste de nombre separes par virgules
$sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
}
if ($search_ref) {
if (is_numeric($search_ref)) $sql .= " AND (d.rowid = ".$db->escape($search_ref).")";
else $sql .= " AND 1 = 2"; // Always wrong
$sql .= natural_search("d.ref", $search_ref);
}
if ($search_civility) $sql .= natural_search("d.civility", $search_civility);
if ($search_firstname) $sql .= natural_search("d.firstname", $search_firstname);
@ -604,7 +611,7 @@ print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $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.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], 'd.ref', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'], $_SERVER["PHP_SELF"], 'd.civility', '', $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);
@ -644,7 +651,7 @@ while ($i < min($num, $limit)) {
$datefin = $db->jdate($obj->datefin);
$memberstatic->id = $obj->rowid;
$memberstatic->ref = $obj->rowid;
$memberstatic->ref = $obj->ref;
$memberstatic->civility_id = $obj->civility;
$memberstatic->lastname = $obj->lastname;
$memberstatic->firstname = $obj->firstname;

View File

@ -21,7 +21,7 @@
/**
* \file htdocs/admin/fckeditor.php
* \ingroup fckeditor
* \brief Page d'activation du module FCKeditor dans les autres modules
* \brief Activation page for the FCKeditor module in the other modules
*/
require '../main.inc.php';
@ -43,35 +43,41 @@ $mode = GETPOST('mode') ?GETPOST('mode', 'alpha') : 'dolibarr_notes';
if (!$user->admin) accessforbidden();
// Constante et traduction de la description du module
// Constant and translation of the module description
$modules = array(
'SOCIETE' => 'FCKeditorForCompany',
'PRODUCTDESC' => 'FCKeditorForProduct',
'DETAILS' => 'FCKeditorForProductDetails',
'USERSIGN' => 'FCKeditorForUserSignature',
'MAILING' => 'FCKeditorForMailing',
'MAIL' => 'FCKeditorForMail',
'TICKET' => 'FCKeditorForTicket'
'SOCIETE' => 'FCKeditorForCompany',
'PRODUCTDESC' => 'FCKeditorForProduct',
'DETAILS' => 'FCKeditorForProductDetails',
'USERSIGN' => 'FCKeditorForUserSignature',
'MAILING' => 'FCKeditorForMailing',
'MAIL' => 'FCKeditorForMail',
'TICKET' => 'FCKeditorForTicket',
'NOTE_PUBLIC' => 'FCKeditorForNotePublic',
'NOTE_PRIVATE' => 'FCKeditorForNotePrivate',
);
// Conditions pour que l'option soit proposee
// Conditions for the option to be offered
$conditions = array(
'SOCIETE' => 1,
'PRODUCTDESC' => (!empty($conf->product->enabled) || !empty($conf->service->enabled)),
'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
'USERSIGN' => 1,
'MAILING' => !empty($conf->mailing->enabled),
'MAIL' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)),
'TICKET' => !empty($conf->ticket->enabled)
'SOCIETE' => 1,
'PRODUCTDESC' => (!empty($conf->product->enabled) || !empty($conf->service->enabled)),
'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
'USERSIGN' => 1,
'MAILING' => !empty($conf->mailing->enabled),
'MAIL' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)),
'TICKET' => !empty($conf->ticket->enabled),
'NOTE_PUBLIC' => 1,
'NOTE_PRIVATE' => 1,
);
// Picto
$picto = array(
'SOCIETE' => 'generic',
'PRODUCTDESC' => 'product',
'DETAILS' => 'product',
'USERSIGN' => 'user',
'MAILING' => 'email',
'MAIL' => 'email',
'TICKET' => 'ticket'
'SOCIETE' => 'generic',
'PRODUCTDESC' => 'product',
'DETAILS' => 'product',
'USERSIGN' => 'user',
'MAILING' => 'email',
'MAIL' => 'email',
'TICKET' => 'ticket',
'NOTE_PUBLIC' => 'generic',
'NOTE_PRIVATE' => 'generic',
);
@ -85,7 +91,7 @@ foreach ($modules as $const => $desc)
if ($action == 'activate_'.strtolower($const))
{
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity);
// Si fckeditor est active dans la description produit/service, on l'active dans les formulaires
// If fckeditor is active in the product/service description, it is activated in the forms
if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM))
{
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity);
@ -154,7 +160,7 @@ if (empty($conf->use_javascript_ajax))
// Modules
foreach ($modules as $const => $desc)
{
// Si condition non remplie, on ne propose pas l'option
// If this condition is not met, the option is not offered
if (!$conditions[$const]) continue;
print '<tr class="oddeven">';

View File

@ -35,10 +35,10 @@ $langs->load("categories");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alphanohtml');
$type = GETPOST('type', 'aZ09'); // Can be int or string
$action = (GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'edit');
$confirm = GETPOST('confirm');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = (int) GETPOST('socid', 'int');
$label = (string) GETPOST('label', 'alphanohtml');
@ -56,10 +56,14 @@ if ($id == "") {
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
if ($id > 0) {
$result = $object->fetch($id);
$result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element);
@ -74,8 +78,13 @@ $error = 0;
*/
if ($cancel) {
header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type);
exit;
if ($backtopage) {
header("Location: ".$backtopage);
exit;
} else {
header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type);
exit;
}
}
// Action mise a jour d'une categorie
@ -98,9 +107,15 @@ if ($action == 'update' && $user->rights->categorie->creer) {
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++;
if (!$error && $object->update($user) > 0) {
header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type);
exit;
if (!$error && $object->update($user) > 0)
{
if ($backtopage) {
header("Location: ".$backtopage);
exit;
} else {
header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type);
exit;
}
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -131,6 +146,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print dol_get_fiche_head('');

View File

@ -109,7 +109,7 @@ if (empty($nosearch)) {
foreach ($cats as $cat)
{
$color = $categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #bbb"';
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
print "\t".'<tr class="oddeven">'."\n";
print "\t\t<td>";
@ -160,26 +160,45 @@ foreach ($fulltree as $key => $val)
$categstatic->ref = $val['label'];
$categstatic->color = $val['color'];
$categstatic->type = $type;
$li = $categstatic->getNomUrl(1, '', 60, $moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam));
$desc = dol_htmlcleanlastbr($val['description']);
$counter = '';
if ($conf->global->CATEGORY_SHOW_COUNTS)
{
// we need only a count of the elements, so it is enough to consume only the id's from the database
$elements = $categstatic->getObjectsInCateg($type, 1);
$elements = $type == Categorie::TYPE_ACCOUNT
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
: $categstatic->getObjectsInCateg($type, 1);
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
}
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
$li = $categstatic->getNomUrl(1, '', 60, '&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam));
$data[] = array(
'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories"'.$color.'>'.$li.'</span></td>'.$counter.
'<td class="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).'">'.img_view().'</a></td></tr></table>'
);
$entry = '<table class="nobordernopadding centpercent">';
$entry .= '<tr>';
$entry .= '<td>';
$entry .= '<span class="noborderoncategories" '.$color.'>'.$li.'</span>';
$entry .= '</td>';
$entry .= $counter;
$entry .= '<td class="right" width="20px;">';
$entry .= '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'">'.img_view().'</a>';
$entry .= '</td>';
$entry .= '<td class="right" width="20px;">';
$entry .= '<a class="editfielda" href="'.DOL_URL_ROOT.'/categories/edit.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'">'.img_edit().'</a>';
$entry .= '</td>';
$entry .= '<td class="right" width="20px;">';
$entry .= '<a class="deletefilelink" href="'.DOL_URL_ROOT.'/categories/viewcat.php?action=delete&token='.newToken().'&id='.$val['id'].'&type='.$type.$moreparam.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).'">'.img_delete().'</a>';
$entry .= '</td>';
$entry .= '</tr>';
$entry .= '</table>';
$data[] = array('rowid' => $val['rowid'], 'fk_menu' => $val['fk_parent'], 'entry' => $entry);
}
@ -194,7 +213,6 @@ if (!empty($conf->use_javascript_ajax))
print '</td></tr>';
$nbofentries = (count($data) - 1);
if ($nbofentries > 0)
{
print '<tr class="pair"><td colspan="3">';

View File

@ -37,16 +37,18 @@ $langs->loadLangs(array('categories', 'sendings'));
$socid = 0;
$id = GETPOST('id', 'int');
$label = GETPOST('label', 'alpha');
// Security check
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
if (!$object->fetch($id) > 0) {
dol_print_error($db);
exit;
$result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
@ -63,11 +65,11 @@ llxHeader('', $langs->trans('Categories'), '');
$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
$head = categories_prepare_head($object, $type);
print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category');
$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
$linkback = '<a href="'.$backtolist.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = ' type = '.$type;
$object->next_prev_filter = ' type = '.$object->type;
$object->ref = $object->label;
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);

View File

@ -38,7 +38,6 @@ $langs->loadlangs(array('categories', 'bills'));
$id = GETPOST('id', 'int');
$label = GETPOST('label', 'alpha');
$type = GETPOST('type');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm');
@ -52,18 +51,16 @@ if ($id == '' && $label == '')
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
$result = $object->fetch($id, $label, $type);
$result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$object->fetch_optionals();
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$upload_dir = $conf->categorie->multidir_output[$object->entity];
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$upload_dir = $conf->categorie->multidir_output[$object->entity];
/*
* Actions
*/
@ -115,8 +112,6 @@ if ($object->id)
$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
$head = categories_prepare_head($object, $type);
print dol_get_fiche_head($head, 'photos', $langs->trans($title), -1, 'category');
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';

View File

@ -39,7 +39,6 @@ $id = GETPOST('id', 'int');
$label = GETPOST('label', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$type = GETPOST('type', 'aZ09');
if ($id == '' && $label == '')
{
@ -51,15 +50,12 @@ if ($id == '' && $label == '')
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
$result = $object->fetch($id, $label, $type);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$object->fetch_optionals();
$result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
/*

View File

@ -38,7 +38,6 @@ $langs->load("categories");
$id = GETPOST('id', 'int');
$label = GETPOST('label', 'alpha');
$type = GETPOST('type', 'aZ09');
$removeelem = GETPOST('removeelem', 'int');
$elemid = GETPOST('elemid', 'int');
@ -73,19 +72,12 @@ if ($id == "" && $label == "")
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
$result = $object->fetch($id, $label, $type);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$object->fetch_optionals();
$result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$objecttype = $object->type;
if (is_numeric($objecttype)) $objecttype = Categorie::$MAP_ID_TO_CODE[$objecttype];
if ($type === '') $type = $objecttype;
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$extrafields = new ExtraFields($db);
@ -94,16 +86,18 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard', 'globalcard'));
// Protection when type provided is not similare to type of category
if ($objecttype != $type) {
print 'Error: Value for type parameter does not match value of the type of the category with id='.$id;
exit;
}
/*
* Actions
*/
if ($confirm == 'no')
{
if ($backtopage) {
header("Location: ".$backtopage);
exit;
}
}
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Remove element from category
@ -164,8 +158,13 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
{
if ($object->delete($user) >= 0)
{
header("Location: ".DOL_URL_ROOT.'/categories/index.php?type='.$type);
exit;
if ($backtopage) {
header("Location: ".$backtopage);
exit;
} else {
header("Location: ".DOL_URL_ROOT.'/categories/index.php?type='.$type);
exit;
}
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -226,9 +225,8 @@ llxHeader("", $langs->trans("Categories"), $helpurl, '', 0, 0, $arrayofjs, $arra
$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
$head = categories_prepare_head($object, $type);
print dol_get_fiche_head($head, 'card', $langs->trans($title), -1, 'category');
$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
$linkback = '<a href="'.$backtolist.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = ' type = '.$object->type;
@ -250,7 +248,11 @@ dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'la
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;type='.$type, $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1);
if ($backtopage) {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&backtopage='.urlencode($backtopage), $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 2);
} else {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type, $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1);
}
}
print '<br>';
@ -294,7 +296,7 @@ if ($user->rights->categorie->creer)
if ($user->rights->categorie->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'">'.$langs->trans("Delete").'</a>';
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'&backtolist='.urlencode($backtolist).'">'.$langs->trans("Delete").'</a>';
}
print "</div>";
@ -376,8 +378,7 @@ if ($cats < 0)
$categstatic->type = $type;
$desc = dol_htmlcleanlastbr($val['description']);
$counter = 0;
$counter = '';
if ($conf->global->CATEGORY_SHOW_COUNTS)
{
// we need only a count of the elements, so it is enough to consume only the id's from the database
@ -385,22 +386,29 @@ if ($cats < 0)
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
: $categstatic->getObjectsInCateg($type, 1);
$counter = is_countable($elements) ? count($elements) : 0;
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
}
$color = $categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"';
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
$li = $categstatic->getNomUrl(1, '', 60, '&backtolist='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.$type));
$entry = '<table class="nobordernopadding centpercent">';
$entry .= '<tr>';
$entry .= '<td>';
$entry .= '<span class="noborderoncategories" '.$color.'>'.$categstatic->getNomUrl(1, '', 60).'</span>';
$entry .= '<span class="noborderoncategories" '.$color.'>'.$li.'</span>';
$entry .= '</td>';
$entry .= '<td class="left" width="40px;">'.$counter.'</td>';
$entry .= $counter;
$entry .= '<td class="right" width="20px;">';
$entry .= '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a>';
$entry .= '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.$type).'">'.img_view().'</a>';
$entry .= '</td>';
$entry .= '<td class="right" width="20px;">';
$entry .= '<a class="editfielda" href="'.DOL_URL_ROOT.'/categories/edit.php?id='.$val['id'].'&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.$type).'">'.img_edit().'</a>';
$entry .= '</td>';
$entry .= '<td class="right" width="20px;">';
$entry .= '<a class="deletefilelink" href="'.DOL_URL_ROOT.'/categories/viewcat.php?action=delete&token='.newToken().'&id='.$val['id'].'&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.$type).'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.$type).'">'.img_delete().'</a>';
$entry .= '</td>';
$entry .= '</tr>';
@ -409,7 +417,8 @@ if ($cats < 0)
$data[] = array('rowid' => $val['rowid'], 'fk_menu' => $val['fk_parent'], 'entry' => $entry);
}
if ((count($data) - 1))
$nbofentries = (count($data) - 1);
if ($nbofentries > 0)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
print '<tr class="pair">';

File diff suppressed because it is too large Load Diff

View File

@ -118,36 +118,48 @@ class Mailing extends CommonObject
/**
* @var int id of user create
* @deprecated
*/
public $user_creation;
/**
* @var int id of user create
* @deprecated
*/
public $user_creat;
/**
* @var int id of user validate
* @deprecated
*/
public $user_validation;
/**
* @var int id of user validate
* @deprecated
*/
public $user_valid;
/**
* @var integer|string date_creation
* @deprecated
*/
public $date_creat;
/**
* @var integer|string date_creation
*/
public $date_creation;
/**
* @var int date validate
* @deprecated
*/
public $date_valid;
/**
* @var int date validate
*/
public $date_validation;
/**
* @var array extraparams
*/
@ -314,10 +326,14 @@ class Mailing extends CommonObject
$this->email_errorsto = $obj->email_errorsto;
$this->user_creat = $obj->fk_user_creat;
$this->user_creation = $obj->fk_user_creat;
$this->user_valid = $obj->fk_user_valid;
$this->user_validation = $obj->fk_user_valid;
$this->date_creat = $this->db->jdate($obj->date_creat);
$this->date_creation = $this->db->jdate($obj->date_creat);
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->date_validation = $this->db->jdate($obj->date_valid);
$this->date_envoi = $this->db->jdate($obj->date_envoi);
$this->extraparams = (array) json_decode($obj->extraparams, true);

View File

@ -33,8 +33,9 @@ $id = GETPOST('id', 'int');
$langs->load("mails");
// Security check
if (!$user->rights->mailing->lire || $user->socid > 0)
accessforbidden();
if (!$user->rights->mailing->lire || $user->socid > 0) {
accessforbidden();
}
@ -48,8 +49,7 @@ $form = new Form($db);
$object = new Mailing($db);
if ($object->fetch($id) >= 0)
{
if ($object->fetch($id) >= 0) {
$head = emailing_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("Mailing"), -1, 'email');
@ -58,13 +58,14 @@ if ($object->fetch($id) >= 0)
$morehtmlright = '';
$nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3)
{
if ($object->statut == 2 || $object->statut == 3) {
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
if ($nbko) {
$morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
}
$morehtmlright .= ') &nbsp; ';
}
@ -73,10 +74,6 @@ if ($object->fetch($id) >= 0)
print '<div class="underbanner clearboth"></div><br>';
//print '<table width="100%"><tr><td>';
$object->user_creation = $object->user_creat;
$object->date_creation = $object->date_creat;
$object->user_validation = $object->user_valid;
$object->date_validation = $object->date_valid;
dol_print_object_info($object, 0);
//print '</td></tr></table>';

View File

@ -1660,7 +1660,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top">';
$note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc) ? $objectsrc->note_public : null));
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
// Private note
@ -1670,7 +1670,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top">';
$note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc)) ? $objectsrc->note_private : null));
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
print '</td></tr>';

View File

@ -1736,7 +1736,7 @@ if ($action == 'create' && $usercancreate)
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>';
@ -1747,7 +1747,7 @@ if ($action == 'create' && $usercancreate)
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
print '</td></tr>';

View File

@ -252,7 +252,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_8, '90%');
print $doleditor->Create(1);
print '</td></tr>';
@ -264,7 +264,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_8, '90%');
print $doleditor->Create(1);
print '</td></tr>';
@ -349,7 +349,7 @@ if ($action == 'create')
print '<tr><td class="tdtop">'.$langs->trans("NotePublic").'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
$doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_8, '90%');
print $doleditor->Create(1);
print "</td></tr>";
@ -360,7 +360,7 @@ if ($action == 'create')
print '<tr><td class="tdtop">'.$langs->trans("NotePrivate").'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
$doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_8, '90%');
print $doleditor->Create(1);
print "</td></tr>";

View File

@ -1008,7 +1008,7 @@ if ($action == 'create')
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic');
print '</td>';
print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
// Private note
@ -1019,7 +1019,7 @@ if ($action == 'create')
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate');
print '</td>';
print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
print '</td></tr>';

View File

@ -3534,7 +3534,7 @@ if ($action == 'create')
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext);
print '</td>';
print '<td valign="top" colspan="2">';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
// Private note
@ -3545,7 +3545,7 @@ if ($action == 'create')
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext);
print '</td>';
print '<td valign="top" colspan="2">';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
print '</td></tr>';

View File

@ -1129,13 +1129,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Note Public
print '<tr><td class="tdtop"><label for="note_public">'.$langs->trans("NotePublic").'</label></td><td colspan="3">';
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
// Note Private
print '<tr><td class="tdtop"><label for="note_private">'.$langs->trans("NotePrivate").'</label></td><td colspan="3">';
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';

View File

@ -1174,14 +1174,14 @@ if ($action == 'create')
}
print '<tr><td>'.$langs->trans("NotePublic").'</td><td class="tdtop">';
$doleditor = new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
if (empty($user->socid))
{
print '<tr><td>'.$langs->trans("NotePrivate").'</td><td class="tdtop">';
$doleditor = new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
}

View File

@ -2954,18 +2954,25 @@ abstract class CommonObject
// Special cas
if ($this->table_element == 'product' && $newsuffix == '_private') $newsuffix = '';
if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
$fieldusermod = "fk_user_mod";
} elseif ($this->table_element == 'ecm_files') {
$fieldusermod = "fk_user_m";
} else {
$fieldusermod = "fk_user_modif";
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET note".$newsuffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
$sql .= " ,".(in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment')) ? "fk_user_mod" : "fk_user_modif")." = ".$user->id;
$sql .= " ,".$fieldusermod." = ".$user->id;
$sql .= " WHERE rowid =".$this->id;
dol_syslog(get_class($this)."::update_note", LOG_DEBUG);
if ($this->db->query($sql))
{
if ($suffix == '_public') $this->note_public = $note;
elseif ($suffix == '_private') $this->note_private = $note;
else {
if ($this->db->query($sql)) {
if ($suffix == '_public') {
$this->note_public = $note;
} elseif ($suffix == '_private') {
$this->note_private = $note;
} else {
$this->note = $note; // deprecated
$this->note_private = $note;
}

View File

@ -57,7 +57,7 @@ function categories_prepare_head(Categorie $object, $type)
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/categories/info.php?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/categories/info.php?id='.$object->id.'&amp;type='.$type;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;

View File

@ -111,6 +111,16 @@ function ecm_file_prepare_head($object)
$head[$h][2] = 'card';
$h++;
// Notes
$head[$h][0] = DOL_URL_ROOT.'/ecm/file_note.php?section='.$object->section_id.'&urlfile='.urlencode($object->label);
$head[$h][1] = $langs->trans("Notes");
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
$head[$h][2] = 'note';
$h++;
return $head;
}

View File

@ -263,6 +263,7 @@ class modCommande extends DolibarrModules
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_commande';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('commande').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
// Imports
//--------
$r = 0;

View File

@ -306,7 +306,7 @@ class modExpedition extends DolibarrModules
}
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('expedition').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
}

View File

@ -291,7 +291,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')';
if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
$r++;
@ -371,7 +371,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account';
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')';
if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
$r++;
}

View File

@ -254,7 +254,7 @@ class modPropale extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('propal').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
// Imports
//--------

View File

@ -231,7 +231,7 @@ class modReception extends DolibarrModules
}
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_reception AND ed.fk_commandefourndet = cd.rowid';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('reception').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
}

View File

@ -79,11 +79,16 @@ if ($module == 'propal') {
$permission = $user->rights->expedition->creer;
} elseif ($module == 'product') {
$permission = $user->rights->produit->creer;
} elseif ($module == 'ecmfiles') {
$permission = $user->rights->ecm->setup;
}
//else dol_print_error('','Bad value '.$module.' for param module');
if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
else $typeofdata = 'textarea:12:95%';
if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) {
$typeofdata = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
} else {
$typeofdata = 'textarea:12:95%';
}
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
print '<div class="tagtable border table-border tableforfield centpercent">'."\n";

View File

@ -443,7 +443,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
@ -453,7 +453,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
}

View File

@ -150,6 +150,12 @@ class EcmFiles extends CommonObject
*/
public $src_object_id;
/**
* @var int section_id ID of section = ID of EcmDirectory, directory of manual ECM (not stored into database)
*/
public $section_id;
/**
* Constructor
@ -389,6 +395,8 @@ class EcmFiles extends CommonObject
$sql .= " t.tms as date_m,";
$sql .= " t.fk_user_c,";
$sql .= " t.fk_user_m,";
$sql .= ' t.note_private,';
$sql .= ' t.note_public,';
$sql .= " t.acl,";
$sql .= " t.src_object_type,";
$sql .= " t.src_object_id";
@ -450,6 +458,8 @@ class EcmFiles extends CommonObject
$this->date_m = $this->db->jdate($obj->date_m);
$this->fk_user_c = $obj->fk_user_c;
$this->fk_user_m = $obj->fk_user_m;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->acl = $obj->acl;
$this->src_object_type = $obj->src_object_type;
$this->src_object_id = $obj->src_object_id;

View File

@ -36,14 +36,15 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
if (!$user->rights->ecm->setup) accessforbidden();
if (!$user->rights->ecm->setup) {
accessforbidden();
}
// Get parameters
$socid = GETPOST("socid", "int");
// Security check
if ($user->socid > 0)
{
if ($user->socid > 0) {
$action = '';
$socid = $user->socid;
}
@ -52,22 +53,26 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "label";
if (!$sortorder) {
$sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "label";
}
$section = GETPOST("section", 'alpha');
if (!$section)
{
if (!$section) {
dol_print_error('', 'Error, section parameter missing');
exit;
}
$urlfile = GETPOST("urlfile");
if (!$urlfile)
{
$urlfile = (string) dol_sanitizePathName(GETPOST("urlfile"));
if (!$urlfile) {
dol_print_error('', "ErrorParamNotDefined");
exit;
}
@ -75,8 +80,7 @@ if (!$urlfile)
// Load ecm object
$ecmdir = new EcmDirectory($db);
$result = $ecmdir->fetch(GETPOST("section", 'alpha'));
if (!$result > 0)
{
if (!$result > 0) {
dol_print_error($db, $ecmdir->error);
exit;
}
@ -85,13 +89,9 @@ $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
$fullpath = $conf->ecm->dir_output.'/'.$relativepath.$urlfile;
$file = new stdClass();
$file->section_id = $ecmdir->id;
$file->label = $urlfile;
$relativetodocument = 'ecm/'.$relativepath; // $relativepath is relative to ECM dir, we need relative to document
$filepath = $relativepath.$file->label;
$filepathtodocument = $relativetodocument.$file->label;
$filepath = $relativepath.$urlfile;
$filepathtodocument = $relativetodocument.$urlfile;
// Try to load object from index
$object = new ECMFiles($db);
@ -100,8 +100,7 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element);
$result = $object->fetch(0, '', $filepathtodocument);
if ($result < 0)
{
if ($result < 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
}
@ -112,11 +111,9 @@ if ($result < 0)
* Actions
*/
if ($cancel)
{
if ($cancel) {
$action = '';
if ($backtopage)
{
if ($backtopage) {
header("Location: ".$backtopage);
exit;
} else {
@ -126,8 +123,7 @@ if ($cancel)
}
// Rename file
if ($action == 'update')
{
if ($action == 'update') {
$error = 0;
$oldlabel = GETPOST('urlfile', 'alpha');
@ -154,11 +150,9 @@ if ($action == 'update')
// Now we update index of file
$db->begin();
//print $oldfile.' - '.$newfile;
if ($newlabel != $oldlabel)
{
if ($newlabel != $oldlabel) {
$result = dol_move($oldfile, $newfileformove); // This include update of database
if (!$result)
{
if (!$result) {
$langs->load('errors');
setEventMessages($langs->trans('ErrorFailToRenameFile', $oldfile, $newfile), null, 'errors');
$error++;
@ -166,27 +160,25 @@ if ($action == 'update')
// Reload object after the move
$result = $object->fetch(0, '', $newdirrelativetodocument.$newlabel);
if ($result < 0)
{
if ($result < 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
}
}
if (!$error)
{
if ($shareenabled)
{
if (!$error) {
if ($shareenabled) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$object->share = getRandomPassword(true);
} else {
$object->share = '';
}
if ($object->id > 0)
{
if ($object->id > 0) {
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++;
if ($ret < 0) {
$error++;
}
if (!$error) {
// Actions on extra fields
$result = $object->insertExtraFields();
@ -197,8 +189,7 @@ if ($action == 'update')
}
// Call update to set the share key
$result = $object->update($user);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'warnings');
}
} else {
@ -212,15 +203,13 @@ if ($action == 'update')
$object->description = ''; // indexed content
$object->keyword = ''; // keyword content
$result = $object->create($user);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'warnings');
}
}
}
if (!$error)
{
if (!$error) {
$db->commit();
$urlfile = $newlabel;
@ -246,10 +235,11 @@ $form = new Form($db);
llxHeader();
$head = ecm_file_prepare_head($file);
$object->section_id = $ecmdir->id;
$object->label = $urlfile;
$head = ecm_file_prepare_head($object);
if ($action == 'edit')
{
if ($action == 'edit') {
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="section" value="'.$section.'">';
@ -267,12 +257,10 @@ $tmpecmdir = new EcmDirectory($db); // Need to create a new one
$tmpecmdir->fetch($ecmdir->id);
$result = 1;
$i = 0;
while ($tmpecmdir && $result > 0)
{
while ($tmpecmdir && $result > 0) {
$tmpecmdir->ref = $tmpecmdir->label;
$s = $tmpecmdir->getNomUrl(1).$s;
if ($tmpecmdir->fk_parent)
{
if ($tmpecmdir->fk_parent) {
$s = ' -> '.$s;
$result = $tmpecmdir->fetch($tmpecmdir->fk_parent);
} else {
@ -284,8 +272,11 @@ while ($tmpecmdir && $result > 0)
$urlfiletoshow = preg_replace('/\.noexe$/', '', $urlfile);
$s = img_picto('', 'object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s.' -> ';
if ($action == 'edit') $s .= '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfiletoshow.'">';
else $s .= $urlfiletoshow;
if ($action == 'edit') {
$s .= '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfiletoshow.'">';
} else {
$s .= $urlfiletoshow;
}
$linkback = '';
if ($backtopage) {
@ -317,8 +308,7 @@ print '</td></tr>';
print '<tr><td>'.$langs->trans("HashOfFileContent").'</td><td>';
$object = new EcmFiles($db);
$object->fetch(0, '', $filepathtodocument);
if (!empty($object->label))
{
if (!empty($object->label)) {
print $object->label;
} else {
print img_warning().' '.$langs->trans("FileNotYetIndexedInDatabase");
@ -335,45 +325,63 @@ print '<tr><td>'.$langs->trans("DirectDownloadInternalLink").'</td><td>';
$modulepart = 'ecm';
$forcedownload = 1;
$rellink = '/document.php?modulepart='.$modulepart;
if ($forcedownload) $rellink .= '&attachment=1';
if (!empty($object->entity)) $rellink .= '&entity='.$object->entity;
if ($forcedownload) {
$rellink .= '&attachment=1';
}
if (!empty($object->entity)) {
$rellink .= '&entity='.$object->entity;
}
$rellink .= '&file='.urlencode($filepath);
$fulllink = $urlwithroot.$rellink;
print img_picto('', 'globe').' ';
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadinternallink" name="downloadinternellink" value="'.dol_escape_htmltag($fulllink).'">';
else print $fulllink;
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here.
if ($action != 'edit') {
print '<input type="text" class="quatrevingtpercent" id="downloadinternallink" name="downloadinternellink" value="'.dol_escape_htmltag($fulllink).'">';
} else {
print $fulllink;
}
if ($action != 'edit') {
print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here.
}
print '</td></tr>';
// Link for direct external download
print '<tr><td>';
if ($action != 'edit') print $langs->trans("DirectDownloadLink");
else print $langs->trans("FileSharedViaALink");
if ($action != 'edit') {
print $langs->trans("DirectDownloadLink");
} else {
print $langs->trans("FileSharedViaALink");
}
print '</td><td>';
if (!empty($object->share))
{
if ($action != 'edit')
{
if (!empty($object->share)) {
if ($action != 'edit') {
$forcedownload = 0;
$paramlink = '';
if (!empty($object->share)) $paramlink .= ($paramlink ? '&' : '').'hashp='.$object->share; // Hash for public share
if ($forcedownload) $paramlink .= ($paramlink ? '&' : '').'attachment=1';
if (!empty($object->share)) {
$paramlink .= ($paramlink ? '&' : '').'hashp='.$object->share; // Hash for public share
}
if ($forcedownload) {
$paramlink .= ($paramlink ? '&' : '').'attachment=1';
}
$fulllink = $urlwithroot.'/document.php'.($paramlink ? '?'.$paramlink : '');
//if (! empty($object->ref)) $fulllink.='&hashn='.$object->ref; // Hash of file path
//elseif (! empty($object->label)) $fulllink.='&hashc='.$object->label; // Hash of file content
print img_picto('', 'globe').' ';
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
else print $fulllink;
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here
if ($action != 'edit') {
print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
} else {
print $fulllink;
}
if ($action != 'edit') {
print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here
}
} else {
print '<input type="checkbox" name="shareenabled"'.($object->share ? ' checked="checked"' : '').' /> ';
}
} else {
if ($action != 'edit')
{
if ($action != 'edit') {
print '<span class="opacitymedium">'.$langs->trans("FileNotShared").'</span>';
} else {
print '<input type="checkbox" name="shareenabled"'.($object->share ? ' checked="checked"' : '').' /> ';
@ -390,8 +398,7 @@ print ajax_autoselect('downloadlink');
print dol_get_fiche_end();
if ($action == 'edit')
{
if ($action == 'edit') {
print '<div class="center">';
print '<input type="submit" class="button button-save" name="submit" value="'.$langs->trans("Save").'">';
print ' &nbsp; &nbsp; ';
@ -403,18 +410,15 @@ if ($action == 'edit')
// Confirmation de la suppression d'une ligne categorie
if ($action == 'delete_file')
{
if ($action == 'delete_file') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile', $urlfile), 'confirm_deletefile', '', 1, 1);
}
if ($action != 'edit')
{
if ($action != 'edit') {
// Actions buttons
print '<div class="tabsAction">';
if ($user->rights->ecm->setup)
{
if ($user->rights->ecm->setup) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&section='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
}
/*
@ -426,7 +430,7 @@ if ($action != 'edit')
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
}
*/
*/
print '</div>';
}

184
htdocs/ecm/file_note.php Normal file
View File

@ -0,0 +1,184 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/ecm/file_note.php
* \ingroup ecm
* \brief Fiche de notes sur une ecm file
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
// Load translation files required by the page
$langs->loadLangs(array('ecm'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
if (!$user->rights->ecm->setup) {
accessforbidden();
}
// Get parameters
$socid = GETPOST("socid", "int");
// Security check
if ($user->socid > 0) {
$action = '';
$socid = $user->socid;
}
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
$sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "label";
}
$section = GETPOST("section", 'alpha');
if (!$section) {
dol_print_error('', 'Error, section parameter missing');
exit;
}
$urlfile = (string) dol_sanitizePathName(GETPOST("urlfile"));
if (!$urlfile) {
dol_print_error('', "ErrorParamNotDefined");
exit;
}
// Load ecm object
$ecmdir = new EcmDirectory($db);
$result = $ecmdir->fetch(GETPOST("section", 'alpha'));
if (!$result > 0) {
dol_print_error($db, $ecmdir->error);
exit;
}
$relativepath = $ecmdir->getRelativePath();
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
$fullpath = $conf->ecm->dir_output.'/'.$relativepath.$urlfile;
$relativetodocument = 'ecm/'.$relativepath; // $relativepath is relative to ECM dir, we need relative to document
$filepath = $relativepath.$urlfile;
$filepathtodocument = $relativetodocument.$urlfile;
// Try to load object from index
$object = new ECMFiles($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$result = $object->fetch(0, '', $filepathtodocument);
if ($result < 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
}
$permissionnote = $user->rights->ecm->setup; // Used by the include of actions_setnotes.inc.php
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
/*
* View
*/
llxHeader('', $langs->trans('EcmFiles'));
$form = new Form($db);
$object->section_id = $ecmdir->id;
$object->label = $urlfile;
$head = ecm_file_prepare_head($object);
print dol_get_fiche_head($head, 'note', $langs->trans("File"), -1, 'generic');
$s = '';
$tmpecmdir = new EcmDirectory($db); // Need to create a new one
$tmpecmdir->fetch($ecmdir->id);
$result = 1;
$i = 0;
while ($tmpecmdir && $result > 0) {
$tmpecmdir->ref = $tmpecmdir->label;
$s = $tmpecmdir->getNomUrl(1).$s;
if ($tmpecmdir->fk_parent) {
$s = ' -> '.$s;
$result = $tmpecmdir->fetch($tmpecmdir->fk_parent);
} else {
$tmpecmdir = 0;
}
$i++;
}
$urlfiletoshow = preg_replace('/\.noexe$/', '', $urlfile);
$s = img_picto('', 'object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s.' -> ';
if ($action == 'edit') {
$s .= '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfiletoshow.'">';
} else {
$s .= $urlfiletoshow;
}
$linkback = '';
if ($backtopage) {
$linkback = '<a href="'.$backtopage.'">'.$langs->trans("BackToTree").'</a>';
}
$object->ref = ''; // Force to hide ref
dol_banner_tab($object, '', $linkback, 0, '', '', $s);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$cssclass = "titlefield";
$moreparam = '&amp;section='.$section.'&amp;urlfile='.$urlfile;
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print '</div>';
print dol_get_fiche_end();
// End of page
llxFooter();
$db->close();

View File

@ -941,7 +941,7 @@ if ($action == 'create')
// Note Public
print '<tr><td>'.$langs->trans("NotePublic").'</td>';
print '<td colspan="3">';
$doleditor = new DolEditor('note_public', $object->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $object->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print "</td></tr>";
@ -950,7 +950,7 @@ if ($action == 'create')
{
print '<tr><td>'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="3">';
$doleditor = new DolEditor('note_private', $object->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $object->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print "</td></tr>";
}

View File

@ -1457,7 +1457,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
@ -1467,7 +1467,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
}

View File

@ -941,7 +941,7 @@ if ($action == 'create')
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
//print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>';
@ -952,7 +952,7 @@ if ($action == 'create')
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
//print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
print '</td></tr>';

View File

@ -31,7 +31,7 @@
*/
if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr');
if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (!defined('DOL_VERSION')) define('DOL_VERSION', '14.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (!defined('EURO')) define('EURO', chr(128));

View File

@ -1706,7 +1706,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td>';
//print '<textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea>';
@ -1714,7 +1714,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', isset($note_private) ? $note_private : GETPOST('note_private', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', isset($note_private) ? $note_private : GETPOST('note_private', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td>';
//print '<td><textarea name="note_private" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';

View File

@ -2101,7 +2101,7 @@ if ($action == 'create')
// Public note
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', (GETPOSTISSET('note_public') ?GETPOST('note_public', 'restricthtml') : $note_public), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', (GETPOSTISSET('note_public') ?GETPOST('note_public', 'restricthtml') : $note_public), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td>';
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
@ -2110,7 +2110,7 @@ if ($action == 'create')
// Private note
print '<tr><td>'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', (GETPOSTISSET('note_private') ?GETPOST('note_private', 'restricthtml') : $note_private), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', (GETPOSTISSET('note_private') ?GETPOST('note_private', 'restricthtml') : $note_private), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td>';
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';

View File

@ -4219,8 +4219,10 @@ class nusoap_server extends nusoap_base {
$payload .= $this->getDebugAsXMLComment();
}
$this->outgoing_headers[] = "Server: $this->title Server v$this->version";
preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
// @CHANGE Fix for php8
$rev = array();
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
// Let the Web server decide about this
//$this->outgoing_headers[] = "Connection: Close\r\n";
$payload = $this->getHTTPBody($payload);

View File

@ -439,7 +439,8 @@ if (!file_exists($conffile))
array('from'=>'9.0.0', 'to'=>'10.0.0'),
array('from'=>'10.0.0', 'to'=>'11.0.0'),
array('from'=>'11.0.0', 'to'=>'12.0.0'),
array('from'=>'12.0.0', 'to'=>'13.0.0')
array('from'=>'12.0.0', 'to'=>'13.0.0'),
array('from'=>'13.0.0', 'to'=>'14.0.0')
);
$count = 0;

View File

@ -60,7 +60,6 @@ ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_mrp_mo_fk_object(fk_object);
-- For v13
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (111,11, '0','0','No Sales Tax',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (112,11, '4','0','Sales Tax 4%',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (113,11, '6','0','Sales Tax 6%',1);
@ -399,6 +398,8 @@ CREATE TABLE llx_ecm_files_extrafields
) ENGINE=innodb;
ALTER TABLE llx_ecm_files_extrafields ADD INDEX idx_ecm_files_extrafields (fk_object);
ALTER TABLE llx_ecm_files ADD COLUMN note_private text AFTER fk_user_m;
ALTER TABLE llx_ecm_files ADD COLUMN note_public text AFTER note_private;
CREATE TABLE llx_ecm_directories_extrafields
(
@ -409,6 +410,9 @@ CREATE TABLE llx_ecm_directories_extrafields
) ENGINE=innodb;
ALTER TABLE llx_ecm_directories_extrafields ADD INDEX idx_ecm_directories_extrafields (fk_object);
ALTER TABLE llx_ecm_directories ADD COLUMN note_private text AFTER fk_user_m;
ALTER TABLE llx_ecm_directories ADD COLUMN note_public text AFTER note_private;
ALTER TABLE llx_website_page ADD COLUMN allowed_in_frames integer DEFAULT 0;
ALTER TABLE llx_website_page ADD COLUMN object_type varchar(255);
ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255);

View File

@ -0,0 +1,41 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 13.0.0 or higher.
--
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres):
-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- Note: fields with type BLOB/TEXT can't have default value.
-- Missing in v13 or lower
-- For v14
ALTER TABLE llx_adherent ADD COLUMN ref varchar(30) AFTER rowid;
UPDATE llx_adherent SET ref = rowid WHERE ref = '' or ref IS NULL;
ALTER TABLE llx_adherent MODIFY COLUMN ref varchar(30) NOT NULL;
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_ref (ref, entity);

View File

@ -19,6 +19,7 @@
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login, entity);
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_ref (ref, entity);
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_fk_soc (fk_soc);
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_adherent_type (fk_adherent_type);

View File

@ -27,20 +27,21 @@
create table llx_adherent
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref varchar(30) NOT NULL, -- member reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(128), -- reference into an external system (not used by dolibarr)
gender varchar(10),
civility varchar(6),
lastname varchar(50),
firstname varchar(50),
login varchar(50), -- login
pass varchar(50), -- password
login varchar(50), -- login
pass varchar(50), -- password
pass_crypted varchar(128),
fk_adherent_type integer NOT NULL,
morphy varchar(3) NOT NULL, -- personne morale / personne physique
societe varchar(128), -- company name (should be same length than societe.name). No more used.
fk_soc integer NULL, -- Link to third party linked to member
morphy varchar(3) NOT NULL, -- personne morale / personne physique
societe varchar(128), -- company name (should be same length than societe.name). No more used.
fk_soc integer NULL, -- Link to third party linked to member
address text,
zip varchar(30),
town varchar(50),
@ -48,34 +49,34 @@ create table llx_adherent
country integer,
email varchar(255),
socialnetworks text DEFAULT NULL, -- json with socialnetworks
skype varchar(255),
twitter varchar(255), --
facebook varchar(255), --
linkedin varchar(255), --
instagram varchar(255), --
snapchat varchar(255), --
googleplus varchar(255), --
youtube varchar(255), --
whatsapp varchar(255), --
socialnetworks text DEFAULT NULL, -- json with socialnetworks
skype varchar(255), -- deprecated
twitter varchar(255), -- deprecated
facebook varchar(255), -- deprecated
linkedin varchar(255), -- deprecated
instagram varchar(255), -- deprecated
snapchat varchar(255), -- deprecated
googleplus varchar(255), -- deprecated
youtube varchar(255), -- deprecated
whatsapp varchar(255), -- deprecated
phone varchar(30),
phone_perso varchar(30),
phone_mobile varchar(30),
birth date, -- birthday
photo varchar(255), -- filename or url of photo
birth date, -- birthday
photo varchar(255), -- filename or url of photo
statut smallint NOT NULL DEFAULT 0,
public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ?
datefin datetime, -- date de fin de validite de la cotisation
datefin datetime, -- date de fin de validite de la cotisation
note_private text DEFAULT NULL,
note_public text DEFAULT NULL,
model_pdf varchar(255),
datevalid datetime, -- date de validation
datec datetime, -- date de creation
model_pdf varchar(255),
datevalid datetime, -- date de validation
datec datetime, -- date de creation
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date
fk_user_author integer, -- can be null because member can be create by a guest
fk_user_author integer, -- can be null because member can be create by a guest
fk_user_mod integer,
fk_user_valid integer,
canvas varchar(32), -- type of canvas if used (null by default)
canvas varchar(32), -- type of canvas if used (null by default)
import_key varchar(14) -- Import key
)ENGINE=innodb;

View File

@ -33,5 +33,7 @@ CREATE TABLE llx_ecm_directories
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_c integer,
fk_user_m integer,
note_private text,
note_public text,
acl text
) ENGINE=innodb;

View File

@ -38,5 +38,7 @@ CREATE TABLE llx_ecm_files
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_c integer,
fk_user_m integer,
note_private text,
note_public text,
acl text -- for future permission 'per file'
) ENGINE=innodb;

View File

@ -4332,6 +4332,14 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo
$mod->remove('noboxes');
$mod->init($reloadmode);
}
} elseif ($moduletoreload == 'MAIN_MODULE_EXTERNALSITE') {
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate ExternalSite module");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modExternalSite.class.php';
if ($res) {
$mod = new modExternalSite($db);
$mod->remove('noboxes');
$mod->init($reloadmode);
}
} elseif ($moduletoreload == 'MAIN_MODULE_SOCIETE') {
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Societe module");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php';

View File

@ -40,6 +40,7 @@ PageForCreateEditView=PHP page to create/edit/view a record
PageForAgendaTab=PHP page for event tab
PageForDocumentTab=PHP page for document tab
PageForNoteTab=PHP page for note tab
PageForContactTab=PHP page for contact tab
PathToModulePackage=Path to zip of module/application package
PathToModuleDocumentation=Path to file of module/application documentation (%s)
SpaceOrSpecialCharAreNotAllowed=Spaces or special characters are not allowed.
@ -105,7 +106,7 @@ TryToUseTheModuleBuilder=If you have knowledge of SQL and PHP, you may use the n
SeeTopRightMenu=See <span class="fa fa-bug"></span> on the top right menu
AddLanguageFile=Add language file
YouCanUseTranslationKey=You can use here a key that is the translation key found into language file (see tab "Languages")
DropTableIfEmpty=(Delete table if empty)
DropTableIfEmpty=(Destroy table if empty)
TableDoesNotExists=The table %s does not exists
TableDropped=Table %s deleted
InitStructureFromExistingTable=Build the structure array string of an existing table
@ -138,4 +139,5 @@ ForeignKey=Foreign key
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
AsciiToHtmlConverter=Ascii to HTML converter
AsciiToPdfConverter=Ascii to PDF converter
TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
ModuleBuilderNotAllowed=The module builder is available but not allowed to your user.

View File

@ -315,7 +315,7 @@ if ($action == 'create')
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%');
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_6, '90%');
print $doleditor->Create(1);
print '</td></tr>';
@ -324,7 +324,7 @@ if ($action == 'create')
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%');
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_6, '90%');
print $doleditor->Create(1);
print '</td></tr>';

View File

@ -1125,20 +1125,20 @@ if (!function_exists("llxHeader"))
/**
* Show HTML header HTML + BODY + Top menu + left menu + DIV
*
* @param string $head Optionnal head lines
* @param string $title HTML title
* @param string $help_url Url links to help page
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
* For other external page: http://server/url
* @param string $target Target to use on links
* @param int $disablejs More content into html header
* @param int $disablehead More content into html header
* @param array $arrayofjs Array of complementary js files
* @param array $arrayofcss Array of complementary css files
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
* @param string $morecssonbody More CSS on body tag.
* @param string $replacemainareaby Replace call to main_area() by a print of this string
* @param int $disablenofollow Disable the "nofollow" on page
* @param string $head Optionnal head lines
* @param string $title HTML title
* @param string $help_url Url links to help page
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
* For other external page: http://server/url
* @param string $target Target to use on links
* @param int $disablejs More content into html header
* @param int $disablehead More content into html header
* @param array|string $arrayofjs Array of complementary js files
* @param array|string $arrayofcss Array of complementary css files
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
* @param string $morecssonbody More CSS on body tag. For example 'classforhorizontalscrolloftabs'.
* @param string $replacemainareaby Replace call to main_area() by a print of this string
* @param int $disablenofollow Disable the "nofollow" on page
* @return void
*/
function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0)

View File

@ -57,8 +57,8 @@ $modulename = dol_sanitizeFileName(GETPOST('modulename', 'alpha'));
$objectname = dol_sanitizeFileName(GETPOST('objectname', 'alpha'));
// Security check
if (empty($conf->modulebuilder->enabled)) accessforbidden('ModuleBuilderNotAllowed');
if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden('ModuleBuilderNotAllowed');
if (empty($conf->modulebuilder->enabled)) accessforbidden();
if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden($langs->trans('ModuleBuilderNotAllowed'));
// Dir for custom dirs
@ -226,12 +226,15 @@ if ($dirins && $action == 'initmodule' && $modulename)
// Delete dir and files that can be generated in sub tabs later if we need them (we want a minimal module first)
dol_delete_dir_recursive($destdir.'/build/doxygen');
dol_delete_dir_recursive($destdir.'/core/modules/mailings');
dol_delete_dir_recursive($destdir.'/core/modules/'.strtolower($modulename).'');
dol_delete_dir_recursive($destdir.'/core/tpl');
dol_delete_dir_recursive($destdir.'/core/triggers');
dol_delete_dir_recursive($destdir.'/doc');
dol_delete_dir_recursive($destdir.'/.tx');
dol_delete_dir_recursive($destdir.'/core/boxes');
dol_delete_file($destdir.'/admin/myobject_extrafields.php');
dol_delete_file($destdir.'/sql/data.sql');
dol_delete_file($destdir.'/sql/update_x.x.x-y.y.y.sql');
@ -902,9 +905,11 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
$filetogenerate = array(
'myobject_card.php'=>strtolower($objectname).'_card.php',
'myobject_note.php'=>strtolower($objectname).'_note.php',
'myobject_contact.php'=>strtolower($objectname).'_contact.php',
'myobject_document.php'=>strtolower($objectname).'_document.php',
'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
'myobject_list.php'=>strtolower($objectname).'_list.php',
'admin/myobject_extrafields.php'=>'admin/'.strtolower($objectname).'_extrafields.php',
'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
//'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
@ -1332,9 +1337,11 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
$filetodelete = array(
'myobject_card.php'=>strtolower($objectname).'_card.php',
'myobject_note.php'=>strtolower($objectname).'_note.php',
'myobject_contact.php'=>strtolower($objectname).'_contact.php',
'myobject_document.php'=>strtolower($objectname).'_document.php',
'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
'myobject_list.php'=>strtolower($objectname).'_list.php',
'admin/myobject_extrafields.php'=>'admin/'.strtolower($objectname).'_extrafields.php',
'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
@ -1772,7 +1779,7 @@ if ($module == 'initmodule')
print $langs->trans("EnterNameOfModuleToDeleteDesc").'<br><br>';
print '<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'" value="">';
print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Delete").'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '</form>';
} elseif (!empty($module)) {
// Tabs for module
@ -2309,7 +2316,7 @@ if ($module == 'initmodule')
print $langs->trans("EnterNameOfObjectToDeleteDesc").'<br><br>';
print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">';
print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '</form>';
} else {
// tabobj = module
@ -2336,6 +2343,7 @@ if ($module == 'initmodule')
$pathtodocument = strtolower($module).'/'.strtolower($tabobj).'_document.php';
$pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php';
$pathtonote = strtolower($module).'/'.strtolower($tabobj).'_note.php';
$pathtocontact = strtolower($module).'/'.strtolower($tabobj).'_contact.php';
$pathtophpunit = strtolower($module).'/test/phpunit/'.strtolower($tabobj).'Test.php';
$pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.sql';
$pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'_extrafields.sql';
@ -2354,6 +2362,7 @@ if ($module == 'initmodule')
$realpathtodocument = $dirread.'/'.$pathtodocument;
$realpathtolist = $dirread.'/'.$pathtolist;
$realpathtonote = $dirread.'/'.$pathtonote;
$realpathtocontact = $dirread.'/'.$pathtocontact;
$realpathtophpunit = $dirread.'/'.$pathtophpunit;
$realpathtosql = $dirread.'/'.$pathtosql;
$realpathtosqlextra = $dirread.'/'.$pathtosqlextra;
@ -2377,34 +2386,31 @@ if ($module == 'initmodule')
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi ? '' : '<strike>').$pathtoapi.($realpathtoapi ? '' : '</strike>').'</strong>';
if ($realpathtoapi)
{
if (dol_is_file($realpathtoapi)) {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
print ' &nbsp; ';
if (empty($conf->global->$const_name)) // If module is not activated
{
print '<a href="#" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled", $module).'"><strike>'.$langs->trans("GoToApiExplorer").'</strike></a>';
print '<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled", $module).'"><strike>'.$langs->trans("GoToApiExplorer").'</strike></a>';
} else {
print '<a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>';
}
} else {
//print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> ';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initapi&format=php&file='.urlencode($pathtoapi).'"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a>';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initapi&format=php&file='.urlencode($pathtoapi).'"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a>';
}
// PHPUnit
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit ? '' : '<strike>').$pathtophpunit.($realpathtophpunit ? '' : '</strike>').'</strong>';
if ($realpathtophpunit)
{
if (dol_is_file($realpathtophpunit)) {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
} else {
//print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> ';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initphpunit&format=php&file='.urlencode($pathtophpunit).'"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a>';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initphpunit&format=php&file='.urlencode($pathtophpunit).'"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a>';
}
print '<br>';
@ -2431,24 +2437,24 @@ if ($module == 'initmodule')
//print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra ? '' : '<strike>').$pathtosqlextra.($realpathtosqlextra ? '' : '</strike>').'</strong>';
if ($realpathtosqlextra)
{
if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
print ' &nbsp; ';
print '<a class="reposition editfielda" href="'.$_SERVER["PHP_SELF"].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=droptableextrafields">'.$langs->trans("DropTableIfEmpty").'</a>';
} else {
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initsqlextrafields&format=sql&file='.urlencode($pathtosqlextra).'"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a>';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initsqlextrafields&format=sql&file='.urlencode($pathtosqlextra).'"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a>';
}
//print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileKeyExtraFields").' : <strong>'.($realpathtosqlextrakey ? '' : '<strike>').$pathtosqlextrakey.($realpathtosqlextrakey ? '' : '</strike>').'</strong>';
if ($realpathtosqlextrakey)
{
if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=sql&file='.urlencode($pathtosqlextrakey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtosqlextrakey).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
} else {
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initsqlextrafields&format=sql&file='.urlencode($pathtosqlextra).'"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a>';
}
//print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>';
@ -2463,30 +2469,34 @@ if ($module == 'initmodule')
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard ? '' : '<strike>').$pathtocard.($realpathtocard ? '' : '</strike>').'?action=create</a></strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda ? '' : '<strike>').$pathtoagenda.($realpathtoagenda ? '' : '</strike>').'</strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
if ($realpathtoagenda)
{
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForContactTab").' : <strong>'.($realpathtocontact ? '' : '<strike>').$pathtocontact.($realpathtocontact ? '' : '</strike>').'</strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtocontact).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
if (dol_is_file($realpathtocontact)) {
print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtocontact).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument ? '' : '<strike>').$pathtodocument.($realpathtodocument ? '' : '</strike>').'</strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
if ($realpathtodocument)
{
if (dol_is_file($realpathtodocument)) {
print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote ? '' : '<strike>').$pathtonote.($realpathtonote ? '' : '</strike>').'</strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
if ($realpathtonote)
{
if (dol_is_file($realpathtonote)) {
print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda ? '' : '<strike>').$pathtoagenda.($realpathtoagenda ? '' : '</strike>').'</strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
if (dol_is_file($realpathtoagenda)) {
print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '<br>';
/* This is already on Tab CLI
print '<br>';
@ -2533,8 +2543,7 @@ if ($module == 'initmodule')
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread ? '@'.$dirread : '')).'">';
print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">';
print '<input class="button buttongen" type="submit" name="regenerateclasssql" value="'.$langs->trans("RegenerateClassAndSql").'">';
//print '<input class="button buttongen" type="submit" name="regeneratemissing" value="'.$langs->trans("RegenerateMissingFiles").'">';
print '<input class="button smallpaddingimp" type="submit" name="regenerateclasssql" value="'.$langs->trans("RegenerateClassAndSql").'">';
print '<br><br>';
print load_fiche_titre($langs->trans("ObjectProperties"), '', '');
@ -3073,7 +3082,7 @@ if ($module == 'initmodule')
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
} else {
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inithook&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a></td>';
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inithook&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a></td>';
print '<td></td>';
}
print '</tr>';
@ -3139,7 +3148,7 @@ if ($module == 'initmodule')
} else {
print '<tr><td>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("NoTrigger");
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inittrigger&format=php"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a></td>';
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inittrigger&format=php"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a></td>';
print '<td></td>';
print '</tr>';
}
@ -3190,7 +3199,7 @@ if ($module == 'initmodule')
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
} else {
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcss&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a></td>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcss&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a></td>';
}
print '</tr>';
} else {
@ -3238,7 +3247,7 @@ if ($module == 'initmodule')
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
} else {
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initjs&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a></td>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initjs&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a></td>';
}
print '</tr>';
} else {
@ -3292,7 +3301,7 @@ if ($module == 'initmodule')
}
} else {
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("NoWidget");
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initwidget&format=php"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initwidget&format=php"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a>';
print '</td></tr>';
}
print '</table>';
@ -3374,7 +3383,7 @@ if ($module == 'initmodule')
}
} else {
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("NoCLIFile");
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcli&format=php"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcli&format=php"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a>';
print '</td></tr>';
}
print '</table>';
@ -3412,7 +3421,7 @@ if ($module == 'initmodule')
if ($action != 'editfile' || empty($file))
{
print '<span class="opacitymedium">'.$langs->trans("CronJobDefDesc", '<a href="'.DOL_URL_ROOT.'/cron/list.php">'.$langs->transnoentities('CronList').'</a>').'</span><br>';
print '<span class="opacitymedium">'.str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/cron/list.php">'.$langs->transnoentities('CronList').'</a>', $langs->trans("CronJobDefDesc", '{s1}')).'</span><br>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
@ -3547,7 +3556,7 @@ if ($module == 'initmodule')
} else {
print '<tr><td>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("FileNotYetGenerated");
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initdoc&format=php"><input type="button" class="button buttongen" value="'.$langs->trans("Generate").'"></a></td>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initdoc&format=php"><input type="button" class="button smallpaddingimp" value="'.$langs->trans("Generate").'"></a></td>';
print '</tr>';
}
print '</table>';

View File

@ -26,9 +26,22 @@
* \brief Page to setup extra fields of myobject
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bom.lib.php';
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
// Try main.inc.php using relative path
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
if (!$res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once '../lib/mymodule.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('mymodule@mymodule', 'admin'));

View File

@ -46,23 +46,31 @@ class modMyModule extends DolibarrModules
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'mymodule';
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
// It is used to group modules by family in module setup page
$this->family = "other";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '90';
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
// Module label (no space allowed), used if translation string 'ModuleMyModuleName' not found (MyModule is name of module).
$this->name = preg_replace('/^mod/i', '', get_class($this));
// Module description, used if translation string 'ModuleMyModuleDesc' not found (MyModule is name of module).
$this->description = "MyModuleDescription";
// Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "MyModule description (Long)";
// Author
$this->editor_name = 'Editor name';
$this->editor_url = 'https://www.example.com';
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = '1.0';
// Url to the file with your last numberversion of this module
@ -70,10 +78,13 @@ class modMyModule extends DolibarrModules
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
$this->picto = 'generic';
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
$this->module_parts = array(
// Set this to 1 if module has its own trigger directory (core/triggers)
@ -113,11 +124,14 @@ class modMyModule extends DolibarrModules
// Set this to 1 if features of module are opened to external users
'moduleforexternal' => 0,
);
// Data directories to create when module is enabled.
// Example: this->dirs = array("/mymodule/temp","/mymodule/subdir");
$this->dirs = array("/mymodule/temp");
// Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module.
$this->config_page_url = array("setup.php@mymodule");
// Dependencies
// A condition to hide module
$this->hidden = false;
@ -125,9 +139,15 @@ class modMyModule extends DolibarrModules
$this->depends = array();
$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
// The language file dedicated to your module
$this->langfiles = array("mymodule@mymodule");
// Prerequisites
$this->phpmin = array(5, 5); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module
// Messages at activation
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
//$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice');

View File

@ -0,0 +1,203 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/modulebuilder/template/myobject_contact.php
* \ingroup mymodule
* \brief Tab for contacts linked to MyObject
*/
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
// Try main.inc.php using relative path
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
if (!$res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
dol_include_once('/mymodule/class/myobject.class.php');
dol_include_once('/mymodule/lib/mymodule_myobject.lib.php');
// Load translation files required by the page
$langs->loadLangs(array("mymodule@mymodule", "companies", "other", "mails"));
$id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
// Initialize technical objects
$object = new MyObject($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('myobjectcontact', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $object->id);
$permission = $user->rights->mymodule->myobject->write;
/*
* Add a new contact
*/
if ($action == 'addcontact' && $permission)
{
$contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
if ($result >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
} else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} // Toggle the status of a contact
elseif ($action == 'swapstatut' && $permission)
{
$result = $object->swapContactStatus(GETPOST('ligne'));
} // Deletes a contact
elseif ($action == 'deletecontact' && $permission)
{
$result = $object->delete_contact($lineid);
if ($result >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
} else {
dol_print_error($db);
}
}
/*
* View
*/
$title = $langs->trans('MyObject')." - ".$langs->trans('ContactsAddresses');
$help_url = '';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
$form = new Form($db);
$formcompany = new FormCompany($db);
$contactstatic = new Contact($db);
$userstatic = new User($db);
/* *************************************************************************** */
/* */
/* View and edit mode */
/* */
/* *************************************************************************** */
if ($object->id)
{
/*
* Show tabs
*/
$head = myobjectPrepareHead($object);
print dol_get_fiche_head($head, 'contact', $langs->trans("MyObject"), -1, $object->picto);
$linkback = '<a href="'.dol_buildpath('/mymodule/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
/*
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd)
{
if ($action != 'classify')
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= ': '.$proj->getNomUrl();
} else {
$morehtmlref .= '';
}
}
}*/
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
print dol_get_fiche_end();
print '<br>';
// Contacts lines (modules that overwrite templates must declare this into descriptor)
$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach ($dirtpls as $reldir)
{
$res = @include dol_buildpath($reldir.'/contacts.tpl.php');
if ($res) break;
}
}
// End of page
llxFooter();
$db->close();

View File

@ -2651,14 +2651,14 @@ class Product extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) {
if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.rowid = cd.fk_commande";
$sql .= " AND c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'commande').")";
$sql .= " AND cd.fk_product = ".$this->id;
if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) {
if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($socid > 0) {

View File

@ -365,7 +365,7 @@ if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE))
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
}
llxHeader('', $title, $helpurl);
llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs');
$form = new Form($db);
@ -920,9 +920,9 @@ END;
$param = "&id=".$object->id;
print '<tr class="liste_titre">';
if (!empty($arrayfields['pfp.datec']['checked'])) print_liste_field_titre("AppliedPricesFrom", $_SERVER["PHP_SELF"], "pfp.datec", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre("Suppliers", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("SupplierRef", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['pfp.datec']['checked'])) print_liste_field_titre("AppliedPricesFrom", $_SERVER["PHP_SELF"], "pfp.datec", "", $param, "", $sortfield, $sortorder, '', '', 1);
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre("Suppliers", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder, '', '', 1);
print_liste_field_titre("SupplierRef", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder, '', '', 1);
if (!empty($arrayfields['pfp.fk_availability']['checked'])) print_liste_field_titre("Availability", $_SERVER["PHP_SELF"], "pfp.fk_availability", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['pfp.quantity']['checked'])) print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "pfp.quantity", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');

View File

@ -534,6 +534,7 @@ if ($resql)
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
if ($user->rights->{$rightskey}->supprimer) $arrayofmassactions['predelete'] = "<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
if ($user->rights->{$rightskey}->creer) $arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) $arrayofmassactions = array();

View File

@ -705,7 +705,7 @@ if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE))
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
}
llxHeader('', $title, $helpurl);
llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs');
$head = product_prepare_head($object);
$titre = $langs->trans("CardProduct".$object->type);

View File

@ -785,7 +785,7 @@ if ($action == 'create')
// Note Public
print '<tr><td>'.$langs->trans("NotePublic").'</td>';
print '<td colspan="3">';
$doleditor = new DolEditor('note_public', $object->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', $object->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print "</td></tr>";
@ -794,7 +794,7 @@ if ($action == 'create')
{
print '<tr><td>'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="3">';
$doleditor = new DolEditor('note_private', $object->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', $object->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print "</td></tr>";
}

View File

@ -493,56 +493,56 @@ function createProductOrService($authentication, $product)
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters
if ($product['price_net'] > 0) $product['price_base_type'] = 'HT';
if ($product['price'] > 0) $product['price_base_type'] = 'TTC';
if (empty($product['price_base_type'])) {
if (isset($product['price_net']) && $product['price_net'] > 0) $product['price_base_type'] = 'HT';
if (isset($product['price']) && $product['price'] > 0) $product['price_base_type'] = 'TTC';
}
if ($product['price_net'] > 0 && $product['price'] > 0)
if (isset($product['price_net']) && $product['price_net'] > 0 && isset($product['price']) && $product['price'] > 0)
{
$error++; $errorcode = 'KO'; $errorlabel = "You must choose between price or price_net to provide price.";
}
if ($product['barcode'] && !$product['barcode_type'])
if (!empty($product['barcode']) && empty($product['barcode_type']))
{
$error++; $errorcode = 'KO'; $errorlabel = "You must set a barcode type when setting a barcode.";
}
if (!$error)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$newobject = new Product($db);
$newobject->ref = $product['ref'];
$newobject->ref_ext = $product['ref_ext'];
$newobject->type = $product['type'];
$newobject->label = $product['label'];
$newobject->description = $product['description'];
$newobject->note_public = $product['note_public'];
$newobject->note_private = $product['note_private'];
$newobject->status = $product['status_tosell'];
$newobject->status_buy = $product['status_tobuy'];
$newobject->price = $product['price_net'];
$newobject->price_ttc = $product['price'];
$newobject->tva_tx = $product['vat_rate'];
$newobject->ref_ext = empty($product['ref_ext']) ? '' : $product['ref_ext'];
$newobject->type = empty($product['type']) ? 0 : $product['type'];
$newobject->label = empty($product['label']) ? '' : $product['label'];
$newobject->description = empty($product['description']) ? '' : $product['description'];
$newobject->note_public = empty($product['note_public']) ? '' : $product['note_public'];
$newobject->note_private = empty($product['note_private']) ? '' :$product['note_private'];
$newobject->status = empty($product['status_tosell']) ? 0 : $product['status_tosell'];
$newobject->status_buy = empty($product['status_tobuy']) ? 0 : $product['status_tobuy'];
$newobject->price = isset($product['price_net']) ? $product['price_net'] : 0;
$newobject->price_ttc = isset($product['price']) ? $product['price'] : 0;
$newobject->tva_tx = empty($product['vat_rate']) ? 0 : $product['vat_rate'];
$newobject->price_base_type = $product['price_base_type'];
$newobject->date_creation = $now;
if ($product['barcode'])
if (!empty($product['barcode']))
{
$newobject->barcode = $product['barcode'];
$newobject->barcode_type = $product['barcode_type'];
}
$newobject->stock_reel = $product['stock_real'];
$newobject->pmp = $product['pmp'];
$newobject->seuil_stock_alert = $product['stock_alert'];
$newobject->stock_reel = isset($product['stock_real']) ? $product['stock_real'] : null;
$newobject->pmp = isset($product['pmp']) ? $product['pmp'] : null;
$newobject->seuil_stock_alert = isset($product['stock_alert']) ? $product['stock_alert'] : null;
$newobject->country_id = $product['country_id'];
if ($product['country_code']) $newobject->country_id = getCountry($product['country_code'], 3);
$newobject->customcode = $product['customcode'];
$newobject->country_id = isset($product['country_id']) ? $product['country_id'] : 0;
if (!empty($product['country_code'])) $newobject->country_id = getCountry($product['country_code'], 3);
$newobject->customcode = isset($product['customcode']) ? $product['customcode'] : '';
$newobject->canvas = $product['canvas'];
$newobject->canvas = isset($product['canvas']) ? $product['canvas'] : '';
/*foreach($product['lines'] as $line)
{
$newline=new FactureLigne($db);
@ -565,7 +565,7 @@ function createProductOrService($authentication, $product)
$extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{
$key = 'options_'.$key;
$newobject->array_options[$key] = $product[$key];

View File

@ -180,7 +180,10 @@ class AdherentTest extends PHPUnit\Framework\TestCase
$localobject->initAsSpecimen();
$localobject->typeid=$fk_adherent_type;
$result=$localobject->create($user);
print __METHOD__." result=".$result."\n";
print __METHOD__." result=".$result."\n";
if ($result < 0) {
print $localobject->error;
}
$this->assertLessThan($result, 0);
return $result;

View File

@ -182,7 +182,10 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase
'type'=>1,
'description'=>'This is a new product created from WS PHPUnit test case',
'barcode'=>'123456789012',
'barcode_type'=>2
'barcode_type'=>2,
'price_net'=>10,
'status_tosell'=>1,
'status_tobuy'=>1
)
);
print __METHOD__." call method ".$WS_METHOD."\n";
@ -201,7 +204,7 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase
print $soapclient->response;
print "\n";
}
print var_export($result, true);
print __METHOD__." count(result)=".(is_array($result) ? count($result) : '')."\n";
$this->assertEquals('OK', $result['result']['result_code']);