Merge branch 'develop' of github.com:Dolibarr/dolibarr into scrutinizerfix
This commit is contained in:
commit
75b1518611
@ -9,6 +9,7 @@ For users:
|
||||
---------------
|
||||
|
||||
NEW: Online proposal signature
|
||||
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
|
||||
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
|
||||
NEW: #18326 Workflow: Close order on shipment closing.
|
||||
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
|
||||
|
||||
@ -214,7 +214,7 @@ if ($action == 'validatehistory') {
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->datef = $objp->datef;
|
||||
$facture_static->date = $objp->datef;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
|
||||
@ -559,7 +559,7 @@ if ($result) {
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->datef = $objp->datef;
|
||||
$facture_static->date = $objp->datef;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file hrm/admin/setup.php
|
||||
* \file htdocs/admin/hrm.php
|
||||
* \ingroup hrm
|
||||
* \brief HrmTest setup page.
|
||||
*/
|
||||
|
||||
@ -626,12 +626,18 @@ class Categorie extends CommonObject
|
||||
}
|
||||
|
||||
$arraydelete = array(
|
||||
'categorie_societe' => 'fk_categorie',
|
||||
'categorie_fournisseur' => 'fk_categorie',
|
||||
'categorie_product' => 'fk_categorie',
|
||||
'categorie_fournisseur' => 'fk_categorie',
|
||||
'categorie_societe' => 'fk_categorie',
|
||||
'categorie_member' => 'fk_categorie',
|
||||
'categorie_contact' => 'fk_categorie',
|
||||
'categorie_user' => 'fk_categorie',
|
||||
'categorie_project' => 'fk_categorie',
|
||||
'categorie_account' => 'fk_categorie',
|
||||
'categorie_website_page' => 'fk_categorie',
|
||||
'categorie_warehouse' => 'fk_categorie',
|
||||
'categorie_actioncomm' => 'fk_categorie',
|
||||
'categorie_ticket' => 'fk_categorie',
|
||||
'bank_class' => 'fk_categ',
|
||||
'categorie_lang' => 'fk_category',
|
||||
'categorie' => 'rowid',
|
||||
@ -728,8 +734,6 @@ class Categorie extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Call trigger
|
||||
$this->context = array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger
|
||||
$result = $this->call_trigger('CATEGORY_LINK', $user);
|
||||
@ -755,6 +759,8 @@ class Categorie extends CommonObject
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@ -810,6 +816,8 @@ class Categorie extends CommonObject
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -770,7 +770,7 @@ if ($type == Categorie::TYPE_CONTACT) {
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Ref").'</td></tr>'."\n";
|
||||
|
||||
if (count($contacts) > 0) {
|
||||
if (is_array($contacts) && count($contacts) > 0) {
|
||||
$i = 0;
|
||||
foreach ($contacts as $key => $contact) {
|
||||
$i++;
|
||||
|
||||
@ -1494,13 +1494,13 @@ if ($action == 'create' && $usercancreate) {
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); // TODO maybe add default value option
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
|
||||
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
|
||||
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0));
|
||||
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : 0);
|
||||
$shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0));
|
||||
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
|
||||
$demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
|
||||
$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : '';
|
||||
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ? -1 : '';
|
||||
|
||||
$date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
|
||||
if (empty($date_delivery)) {
|
||||
@ -1526,7 +1526,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$fk_account = $soc->fk_account;
|
||||
$availability_id = $soc->availability_id;
|
||||
$availability_id = 0;
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
$warehouse_id = $soc->warehouse_id;
|
||||
$demand_reason_id = $soc->demand_reason_id;
|
||||
|
||||
@ -223,7 +223,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -303,8 +303,8 @@ class FactureRec extends CommonInvoice
|
||||
$sql .= ", ".((int) $facsrc->socid);
|
||||
$sql .= ", ".((int) $conf->entity);
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", ".(!empty($facsrc->amount) ? ((float) $facsrc->amount) : '0');
|
||||
$sql .= ", ".(!empty($facsrc->remise) ? ((float) $this->remise) : '0');
|
||||
$sql .= ", ".(!empty($facsrc->total_ttc) ? ((float) $facsrc->total_ttc) : '0');
|
||||
$sql .= ", ".(!empty($facsrc->remise_absolue) ? ((float) $this->remise_absolue) : '0');
|
||||
$sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
|
||||
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||
$sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL");
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Module descriptor for ticket system
|
||||
* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||
* 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file core/boxes/box_nb_ticket_last_x_days.php
|
||||
* \file htdocs/core/boxes/box_graph_new_vs_close_ticket.php
|
||||
* \ingroup ticket
|
||||
* \brief This box shows the number of new daily tickets the last X days
|
||||
*/
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Module descriptor for ticket system
|
||||
* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||
* 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file core/boxes/box_ticket_by_severity.php
|
||||
* \file htdocs/core/boxes/box_graph_ticket_by_severity.php
|
||||
* \ingroup ticket
|
||||
* \brief This box shows open tickets by severity
|
||||
*/
|
||||
|
||||
@ -6488,7 +6488,7 @@ abstract class CommonObject
|
||||
|
||||
$out = '';
|
||||
$type = '';
|
||||
$isDependList=0;
|
||||
$isDependList = 0;
|
||||
$param = array();
|
||||
$param['options'] = array();
|
||||
$reg = array();
|
||||
@ -6796,7 +6796,7 @@ abstract class CommonObject
|
||||
|
||||
if (!empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName.':'.$obj->{$parentField};
|
||||
$isDependList=1;
|
||||
$isDependList = 1;
|
||||
}
|
||||
|
||||
$out .= '<option value="'.$obj->rowid.'"';
|
||||
@ -6951,7 +6951,7 @@ abstract class CommonObject
|
||||
|
||||
if (!empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName.':'.$obj->{$parentField};
|
||||
$isDependList=1;
|
||||
$isDependList = 1;
|
||||
}
|
||||
|
||||
$data[$obj->rowid] = $labeltoshow;
|
||||
@ -9485,7 +9485,7 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
$ok=0;
|
||||
$ok = 0;
|
||||
|
||||
// Process
|
||||
foreach ($to_del as $del) {
|
||||
@ -9497,7 +9497,7 @@ abstract class CommonObject
|
||||
$this->errors = $c->errors;
|
||||
break;
|
||||
} else {
|
||||
$ok+=$result;
|
||||
$ok += $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9510,7 +9510,7 @@ abstract class CommonObject
|
||||
$this->errors = $c->errors;
|
||||
break;
|
||||
} else {
|
||||
$ok+=$result;
|
||||
$ok += $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,6 +51,11 @@ abstract class CommonObjectLine extends CommonObject
|
||||
*/
|
||||
public $fk_unit;
|
||||
|
||||
public $date_debut_prevue;
|
||||
public $date_debut_reel;
|
||||
public $date_fin_prevue;
|
||||
public $date_fin_reel;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -250,6 +250,8 @@ class ExtraFields
|
||||
return -1;
|
||||
}
|
||||
|
||||
$result = 0;
|
||||
|
||||
if ($type == 'separate') {
|
||||
$unique = 0;
|
||||
$required = 0;
|
||||
@ -1651,10 +1653,14 @@ class ExtraFields
|
||||
$showsize = 0;
|
||||
if ($type == 'date') {
|
||||
$showsize = 10;
|
||||
$value = dol_print_date($value, 'day'); // For date without hour, date is always GMT for storage and output
|
||||
if ($value !== '') {
|
||||
$value = dol_print_date($value, 'day'); // For date without hour, date is always GMT for storage and output
|
||||
}
|
||||
} elseif ($type == 'datetime') {
|
||||
$showsize = 19;
|
||||
$value = dol_print_date($value, 'dayhour', 'tzuserrel');
|
||||
if ($value !== '') {
|
||||
$value = dol_print_date($value, 'dayhour', 'tzuserrel');
|
||||
}
|
||||
} elseif ($type == 'int') {
|
||||
$showsize = 10;
|
||||
} elseif ($type == 'double') {
|
||||
@ -1978,10 +1984,10 @@ class ExtraFields
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if ($display_type=='card') {
|
||||
$tagtype='tr';
|
||||
$tagtype_dyn='td';
|
||||
} elseif ($display_type=='line') {
|
||||
$tagtype='tr';
|
||||
$tagtype_dyn='td';
|
||||
|
||||
if ($display_type=='line') {
|
||||
$tagtype='div';
|
||||
$tagtype_dyn='span';
|
||||
$colspan=0;
|
||||
|
||||
@ -157,6 +157,8 @@ class FormMail extends Form
|
||||
|
||||
public $lines_model;
|
||||
|
||||
public $withoptiononeemailperrecipient;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -46,6 +46,8 @@
|
||||
*/
|
||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array(), $moreparams = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($minLength)) {
|
||||
$minLength = 1;
|
||||
}
|
||||
|
||||
@ -115,9 +115,10 @@ function getServerTimeZoneInt($refgmtdate = 'now')
|
||||
* @param int $time Date timestamp (or string with format YYYY-MM-DD)
|
||||
* @param int $duration_value Value of delay to add
|
||||
* @param int $duration_unit Unit of added delay (d, m, y, w, h, i)
|
||||
* @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1
|
||||
* @return int New timestamp
|
||||
*/
|
||||
function dol_time_plus_duree($time, $duration_value, $duration_unit)
|
||||
function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -166,7 +167,31 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit)
|
||||
} else {
|
||||
$date->add($interval);
|
||||
}
|
||||
//Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively)
|
||||
if ($ruleforendofmonth == 1 && $duration_unit == 'm') {
|
||||
$timeyear = dol_print_date($time, '%Y');
|
||||
$timemonth = dol_print_date($time, '%m');
|
||||
$timetotalmonths = (($timeyear * 12) + $timemonth);
|
||||
|
||||
$monthsexpected = ($timetotalmonths + $duration_value);
|
||||
|
||||
$newtime = $date->getTimestamp();
|
||||
|
||||
$newtimeyear = dol_print_date($newtime, '%Y');
|
||||
$newtimemonth = dol_print_date($newtime, '%m');
|
||||
$newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
|
||||
|
||||
if ($monthsexpected < $newtimetotalmonths) {
|
||||
$newtimehours = dol_print_date($newtime, '%H');
|
||||
$newtimemins = dol_print_date($newtime, '%M');
|
||||
$newtimesecs = dol_print_date($newtime, '%S');
|
||||
|
||||
$datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
|
||||
$datelim -= (3600 * 24);
|
||||
|
||||
$date->setTimestamp($datelim);
|
||||
}
|
||||
}
|
||||
return $date->getTimestamp();
|
||||
}
|
||||
|
||||
|
||||
@ -140,12 +140,10 @@ function expensereport_admin_prepare_head()
|
||||
$head[$h][2] = 'expensereport';
|
||||
$h++;
|
||||
|
||||
if (!empty($conf->global->MAIN_USE_EXPENSE_RULE)) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_rules.php";
|
||||
$head[$h][1] = $langs->trans("ExpenseReportsRules");
|
||||
$head[$h][2] = 'expenserules';
|
||||
$h++;
|
||||
}
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_rules.php";
|
||||
$head[$h][1] = $langs->trans("ExpenseReportsRules");
|
||||
$head[$h][2] = 'expenserules';
|
||||
$h++;
|
||||
|
||||
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_ik.php";
|
||||
|
||||
@ -2867,6 +2867,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
if ($fuser->admin) {
|
||||
$accessallowed = 1; // If user is admin
|
||||
}
|
||||
|
||||
$tmpmodulepart = explode('-', $modulepart);
|
||||
if (!empty($tmpmodulepart[1])) {
|
||||
$modulepart = $tmpmodulepart[0];
|
||||
@ -2946,6 +2947,9 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('checkSecureAccess', $parameters, $object);
|
||||
if ($reshook > 0) {
|
||||
if (!empty($hookmanager->resArray['original_file'])) {
|
||||
$original_file = $hookmanager->resArray['original_file'];
|
||||
}
|
||||
if (!empty($hookmanager->resArray['accessallowed'])) {
|
||||
$accessallowed = $hookmanager->resArray['accessallowed'];
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -24,6 +24,7 @@
|
||||
* \file htdocs/core/lib/import.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module import
|
||||
* \ingroup import
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function to return list of tabs for import pages
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
* \defgroup eventorganization Module EventOrganization
|
||||
* \brief EventOrganization module descriptor.
|
||||
*
|
||||
* \file htdocs/eventorganization/core/modules/modEventOrganization.class.php
|
||||
* \file htdocs/core/modules/modEventOrganization.class.php
|
||||
* \ingroup eventorganization
|
||||
* \brief Description and activation file for the EventOrganization
|
||||
*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 SuperAdmin
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -22,7 +22,7 @@
|
||||
* \defgroup knowledgemanagement Module KnowledgeManagement
|
||||
* \brief KnowledgeManagement module descriptor.
|
||||
*
|
||||
* \file htdocs/knowledgemanagement/core/modules/modKnowledgeManagement.class.php
|
||||
* \file htdocs/core/modules/modKnowledgeManagement.class.php
|
||||
* \ingroup knowledgemanagement
|
||||
* \brief Description and activation file for module KnowledgeManagement
|
||||
*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Dorian Laurent <i.merraha@sofimedmaroc.com>
|
||||
* Copyright (C) 2021 NextGestion <contact@nextgestion.com>
|
||||
*
|
||||
@ -23,7 +23,7 @@
|
||||
* \defgroup partnership Module Partnership
|
||||
* \brief Partnership module descriptor.
|
||||
*
|
||||
* \file htdocs/partnership/core/modules/modPartnership.class.php
|
||||
* \file htdocs/core/modules/modPartnership.class.php
|
||||
* \ingroup partnership
|
||||
* \brief Description and activation file for module Partnership
|
||||
*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,7 +21,7 @@
|
||||
* \defgroup recruitment Module Recruitment
|
||||
* \brief Recruitment module descriptor.
|
||||
*
|
||||
* \file htdocs/recruitment/core/modules/modRecruitment.class.php
|
||||
* \file htdocs/core/modules/modRecruitment.class.php
|
||||
* \ingroup recruitment
|
||||
* \brief Description and activation file for the module Recruitment
|
||||
*/
|
||||
|
||||
@ -90,7 +90,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 251;
|
||||
$this->rights[$r][1] = 'Consulter les autres utilisateurs';
|
||||
$this->rights[$r][1] = 'Read information of other users';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user';
|
||||
@ -98,7 +98,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 252;
|
||||
$this->rights[$r][1] = 'Consulter les permissions des autres utilisateurs';
|
||||
$this->rights[$r][1] = 'Read permissions of other users';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user_advance';
|
||||
@ -106,7 +106,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 253;
|
||||
$this->rights[$r][1] = 'Creer/modifier utilisateurs internes et externes';
|
||||
$this->rights[$r][1] = 'Create/modify internal and external users';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user';
|
||||
@ -114,7 +114,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 254;
|
||||
$this->rights[$r][1] = 'Creer/modifier utilisateurs externes seulement';
|
||||
$this->rights[$r][1] = 'Create/modify external users only';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user_advance';
|
||||
@ -122,7 +122,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 255;
|
||||
$this->rights[$r][1] = 'Modifier le mot de passe des autres utilisateurs';
|
||||
$this->rights[$r][1] = 'Modify the password of other users';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user';
|
||||
@ -130,7 +130,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 256;
|
||||
$this->rights[$r][1] = 'Supprimer ou desactiver les autres utilisateurs';
|
||||
$this->rights[$r][1] = 'Delete or disable other users';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user';
|
||||
@ -138,7 +138,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 341;
|
||||
$this->rights[$r][1] = 'Consulter ses propres permissions';
|
||||
$this->rights[$r][1] = 'Read its own permissions';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
@ -146,7 +146,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 342;
|
||||
$this->rights[$r][1] = 'Creer/modifier ses propres infos utilisateur';
|
||||
$this->rights[$r][1] = 'Create/modify of its own user';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'self';
|
||||
@ -154,7 +154,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 343;
|
||||
$this->rights[$r][1] = 'Modifier son propre mot de passe';
|
||||
$this->rights[$r][1] = 'Modify its own password';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'self';
|
||||
@ -162,7 +162,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 344;
|
||||
$this->rights[$r][1] = 'Modifier ses propres permissions';
|
||||
$this->rights[$r][1] = 'Modify its own permissions';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
@ -202,7 +202,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 358;
|
||||
$this->rights[$r][1] = 'Exporter les utilisateurs';
|
||||
$this->rights[$r][1] = 'Export all users';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -22,7 +22,7 @@
|
||||
* \defgroup workstation Module Workstation
|
||||
* \brief Workstation module descriptor.
|
||||
*
|
||||
* \file htdocs/workstation/core/modules/modWorkstation.class.php
|
||||
* \file htdocs/core/modules/modWorkstation.class.php
|
||||
* \ingroup workstation
|
||||
* \brief Description and activation file for the module Workstation
|
||||
*/
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mrp/doc/pdf_vinci.php
|
||||
* \file htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
|
||||
* \ingroup mrp
|
||||
* \brief File of class to generate MO document from vinci model
|
||||
*/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2017 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2017 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* 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
|
||||
|
||||
@ -383,7 +383,7 @@ class ConferenceOrBooth extends ActionComm
|
||||
$error = 0;
|
||||
|
||||
// Protection
|
||||
if ($this->status == self::STATUS_VALIDATED) {
|
||||
if ($this->status == self::STATUS_CONFIRMED) {
|
||||
dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
@ -412,44 +412,8 @@ class ConferenceOrBooth extends ActionComm
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->oldref = $this->ref;
|
||||
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'conferenceorbooth/".$this->db->escape($this->newref)."'";
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'conferenceorbooth/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->eventorganization->dir_output.'/conferenceorbooth/'.$oldref;
|
||||
$dirdest = $conf->eventorganization->dir_output.'/conferenceorbooth/'.$newref;
|
||||
if (!$error && file_exists($dirsource)) {
|
||||
dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
if (@rename($dirsource, $dirdest)) {
|
||||
dol_syslog("Rename ok");
|
||||
// Rename docs starting with $oldref with $newref
|
||||
$listoffiles = dol_dir_list($conf->eventorganization->dir_output.'/conferenceorbooth/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
foreach ($listoffiles as $fileentry) {
|
||||
$dirsource = $fileentry['name'];
|
||||
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
|
||||
$dirsource = $fileentry['path'].'/'.$dirsource;
|
||||
$dirdest = $fileentry['path'].'/'.$dirdest;
|
||||
@rename($dirsource, $dirdest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set new ref and current status
|
||||
if (!$error) {
|
||||
$this->ref = $num;
|
||||
$this->status = self::STATUS_CONFIRMED;
|
||||
}
|
||||
|
||||
|
||||
@ -982,28 +982,6 @@ class ConferenceOrBoothAttendee extends CommonObject
|
||||
$this->initAsSpecimenCommon();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an array of lines
|
||||
*
|
||||
* @return array|int array of lines if OK, <0 if KO
|
||||
*/
|
||||
public function getLinesArray()
|
||||
{
|
||||
$this->lines = array();
|
||||
|
||||
$objectline = new ConferenceOrBoothAttendeeLine($this->db);
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_conferenceorboothattendee = '.((int) $this->id)));
|
||||
|
||||
if (is_numeric($result)) {
|
||||
$this->error = $this->error;
|
||||
$this->errors = $this->errors;
|
||||
return $result;
|
||||
} else {
|
||||
$this->lines = $result;
|
||||
return $this->lines;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reference to the following non used object depending on the active numbering module.
|
||||
*
|
||||
|
||||
@ -487,7 +487,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -590,58 +590,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
|
||||
if (!empty($object->table_element_line)) {
|
||||
// Show object lines
|
||||
$result = $object->getLinesArray();
|
||||
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
|
||||
<input type="hidden" name="token" value="' . newToken().'">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
|
||||
<input type="hidden" name="mode" value="">
|
||||
<input type="hidden" name="page_y" value="">
|
||||
<input type="hidden" name="id" value="' . $object->id.'">
|
||||
';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
}
|
||||
|
||||
if (!empty($object->lines)) {
|
||||
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1);
|
||||
}
|
||||
|
||||
// Form to add new line
|
||||
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
|
||||
if ($action != 'editline') {
|
||||
// Add products/services form
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if (empty($reshook))
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||
print '</table>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
|
||||
// Buttons for actions
|
||||
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
|
||||
@ -266,7 +266,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -42,7 +42,7 @@ function conferenceorboothPrepareHead($object, $with_project = 0)
|
||||
$withProjectUrl = "&withproject=1";
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.ph?id='.$object->id.$withProjectUrl;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$object->id.$withProjectUrl;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
@ -127,6 +127,7 @@ function conferenceorboothProjectPrepareHead($object)
|
||||
$head[$h][2] = 'conferenceorbooth';
|
||||
// Enable caching of conf or booth count attendees
|
||||
$nbAttendees = 0;
|
||||
$nbConferenceOrBooth= 0;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_conferenceorbooth_project_'.$object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
|
||||
@ -2050,6 +2050,11 @@ if ($action == 'create') {
|
||||
// Picture
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
|
||||
// Information if theres a rule restriction
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
|
||||
// Ajout des boutons de modification/suppression
|
||||
if (($object->status < 2 || $object->status == 99) && $user->rights->expensereport->creer) {
|
||||
print '<td class="right"></td>';
|
||||
@ -2190,6 +2195,10 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowrap right">';
|
||||
print !empty($line->rule_warning_message) ? img_warning(html_entity_decode($line->rule_warning_message)) : ' ';
|
||||
print '</td>';
|
||||
|
||||
// Ajout des boutons de modification/suppression
|
||||
if (($object->status < ExpenseReport::STATUS_VALIDATED || $object->status == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) {
|
||||
print '<td class="nowrap right">';
|
||||
@ -2209,7 +2218,7 @@ if ($action == 'create') {
|
||||
|
||||
if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int')) {
|
||||
// Add line with link to add new file or attach line to an existing file
|
||||
$colspan = 10;
|
||||
$colspan = 11;
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$colspan++;
|
||||
}
|
||||
@ -2336,6 +2345,9 @@ if ($action == 'create') {
|
||||
print '<td class="center">';
|
||||
//print $line->fk_ecm_files;
|
||||
print '</td>';
|
||||
// Information if theres a rule restriction
|
||||
print '<td class="center">';
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
|
||||
@ -2351,7 +2363,7 @@ if ($action == 'create') {
|
||||
|
||||
// Add a new line
|
||||
if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer) {
|
||||
$colspan = 11;
|
||||
$colspan = 12;
|
||||
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
||||
$colspan++;
|
||||
}
|
||||
@ -2448,6 +2460,7 @@ if ($action == 'create') {
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven nohover">';
|
||||
|
||||
@ -998,7 +998,7 @@ class ExpenseReport extends CommonObject
|
||||
$sql .= ' de.localtax1_tx, de.localtax2_tx, de.localtax1_type, de.localtax2_type,';
|
||||
$sql .= ' de.fk_ecm_files,';
|
||||
$sql .= ' de.total_ht, de.total_tva, de.total_ttc,';
|
||||
$sql .= ' de.total_localtax1, de.total_localtax2,';
|
||||
$sql .= ' de.total_localtax1, de.total_localtax2, de.rule_warning_message,';
|
||||
$sql .= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
||||
$sql .= ' p.ref as ref_projet, p.title as title_projet';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
|
||||
@ -1055,6 +1055,8 @@ class ExpenseReport extends CommonObject
|
||||
$deplig->projet_ref = $objp->ref_projet;
|
||||
$deplig->projet_title = $objp->title_projet;
|
||||
|
||||
$deplig->rule_warning_message = $objp->rule_warning_message;
|
||||
|
||||
$deplig->rang = $objp->rang;
|
||||
|
||||
$this->lines[$i] = $deplig;
|
||||
@ -1874,10 +1876,6 @@ class ExpenseReport extends CommonObject
|
||||
|
||||
$langs->load('trips');
|
||||
|
||||
if (empty($conf->global->MAIN_USE_EXPENSE_RULE)) {
|
||||
return true; // if don't use rules
|
||||
}
|
||||
|
||||
// We don't know seller and buyer for expense reports
|
||||
if (!is_object($seller)) {
|
||||
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
|
||||
@ -1914,12 +1912,12 @@ class ExpenseReport extends CommonObject
|
||||
$this->errors[] = $this->error;
|
||||
|
||||
$new_current_total_ttc -= $amount_to_test - $rule->amount; // ex, entered 16€, limit 12€, subtracts 4€;
|
||||
$rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationError', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency), $langs->trans('by'.$rule->code_expense_rules_type, price($new_current_total_ttc, 0, $langs, 1, -1, -1, $conf->currency)));
|
||||
$rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationError', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency));
|
||||
} else {
|
||||
$this->error = 'ExpenseReportConstraintViolationWarning';
|
||||
$this->errors[] = $this->error;
|
||||
|
||||
$rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationWarning', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency), $langs->trans('nolimitby'.$rule->code_expense_rules_type));
|
||||
$rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationWarning', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency));
|
||||
}
|
||||
|
||||
// No break, we sould test if another rule is violated
|
||||
@ -1975,7 +1973,7 @@ class ExpenseReport extends CommonObject
|
||||
}
|
||||
//$buyer = new Societe($this->db);
|
||||
|
||||
$expenseik = new ExpenseReportIk($db);
|
||||
$expenseik = new ExpenseReportIk($this->db);
|
||||
$range = $expenseik->getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
|
||||
|
||||
if (empty($range)) {
|
||||
@ -2603,6 +2601,8 @@ class ExpenseReportLine
|
||||
*/
|
||||
public $fk_ecm_files;
|
||||
|
||||
public $rule_warning_message;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -2624,7 +2624,7 @@ class ExpenseReportLine
|
||||
{
|
||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,';
|
||||
$sql .= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,';
|
||||
$sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2,';
|
||||
$sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2, fde.rule_warning_message,';
|
||||
$sql .= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
||||
$sql .= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
||||
@ -2670,6 +2670,8 @@ class ExpenseReportLine
|
||||
|
||||
$this->fk_ecm_files = $objp->fk_ecm_files;
|
||||
|
||||
$this->rule_warning_message = $objp->rule_warning_message;
|
||||
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
|
||||
@ -165,7 +165,7 @@ class ExpenseReportIk extends CoreObject
|
||||
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
|
||||
}
|
||||
$sql .= ' WHERE r.fk_c_exp_tax_cat = '.((int) $fk_c_exp_tax_cat);
|
||||
$sql .= " AND entity IN(0, ".getEntity($this->element).")";
|
||||
$sql .= " AND r.entity IN(0, ".getEntity($this->element).")";
|
||||
if ($active) {
|
||||
$sql .= ' AND r.active = 1 AND c.active = 1';
|
||||
}
|
||||
|
||||
@ -201,6 +201,10 @@ class SupplierInvoices extends DolibarrApi
|
||||
/**
|
||||
* Create supplier invoice object
|
||||
*
|
||||
* Note: soc_id = dolibarr_order_id
|
||||
*
|
||||
* Example: {'ref': 'auto', 'ref_supplier': '7985630', 'socid': 1, 'note': 'Inserted with Python', 'order_supplier': 1, 'date': '2021-07-28'}
|
||||
*
|
||||
* @param array $request_data Request datas
|
||||
*
|
||||
* @return int ID of supplier invoice
|
||||
@ -525,6 +529,10 @@ class SupplierInvoices extends DolibarrApi
|
||||
/**
|
||||
* Add a line to given supplier invoice
|
||||
*
|
||||
* Note: socid = dolibarr_order_id, pu_ht = net price, remise = discount
|
||||
*
|
||||
* Example: {'socid': 1, 'qty': 1, 'pu_ht': 21.0, 'tva_tx': 25.0, 'fk_product': '1189', 'product_type': 0, 'remise_percent': 1.0, 'vat_src_code': None}
|
||||
*
|
||||
* @param int $id Id of supplier invoice to update
|
||||
* @param array $request_data supplier invoice line data
|
||||
*
|
||||
|
||||
@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -59,7 +59,7 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_
|
||||
-- VMYSQL4.3 ALTER TABLE llx_eventorganization_conferenceorboothattendee MODIFY COLUMN fk_actioncomm integer NULL;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_actioncomm DROP NOT NULL;
|
||||
|
||||
|
||||
ALTER TABLE llx_mrp_mo ADD COLUMN last_main_doc varchar(255);
|
||||
|
||||
UPDATE llx_extrafields SET elementtype = 'salary' WHERE elementtype = 'payment_salary';
|
||||
ALTER TABLE llx_payment_salary_extrafields RENAME TO llx_salary_extrafields;
|
||||
|
||||
@ -39,6 +39,7 @@ CREATE TABLE llx_mrp_mo(
|
||||
date_start_planned datetime,
|
||||
date_end_planned datetime,
|
||||
fk_bom integer,
|
||||
fk_project integer
|
||||
fk_project integer,
|
||||
last_main_doc varchar(255)
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/intracommreport.php
|
||||
* \file htdocs/intracommreport/admin/intracommreport.php
|
||||
* \ingroup intracommreport
|
||||
* \brief Page to setup the module intracomm report
|
||||
*/
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php
|
||||
* \file htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php
|
||||
* \ingroup knowledgemanagement
|
||||
* \brief File containing class for advanced numbering model of KnowledgeRecord
|
||||
*/
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php
|
||||
* \file htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php
|
||||
* \ingroup knowledgemanagement
|
||||
* \brief File of class to manage KnowledgeRecord numbering rules standard
|
||||
*/
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/knowledgemanagement/modules_knowledgerecord.php
|
||||
* \file htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php
|
||||
* \ingroup knowledgemanagement
|
||||
* \brief File that contains parent class for knowledgerecords document models and parent class for knowledgerecords numbering models
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) ---Put here your own copyright and developer email---
|
||||
/* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/knowledgemanagementlib/knowledgemanagement_knowledgerecord.lib.php
|
||||
* \file htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php
|
||||
* \ingroup knowledgemanagement
|
||||
* \brief Library files with common functions for KnowledgeRecord
|
||||
*/
|
||||
|
||||
@ -112,7 +112,7 @@ ConfirmCloneExpenseReport=Are you sure you want to clone this expense report ?
|
||||
ExpenseReportsIk=Configuration of mileage charges
|
||||
ExpenseReportsRules=Expense report rules
|
||||
ExpenseReportIkDesc=You can modify the calculation of kilometers expense by category and range who they are previously defined. <b>d</b> is the distance in kilometers
|
||||
ExpenseReportRulesDesc=You can create or update any rules of calculation. This part will be used when user will create a new expense report
|
||||
ExpenseReportRulesDesc=You can define max amount rules for expense reports. These rules will be applied when a new expense is added to an expense report
|
||||
expenseReportOffset=Offset
|
||||
expenseReportCoef=Coefficient
|
||||
expenseReportTotalForFive=Example with <u>d</u> = 5
|
||||
@ -127,19 +127,19 @@ ExpenseReportDomain=Domain to apply
|
||||
ExpenseReportLimitOn=Limit on
|
||||
ExpenseReportDateStart=Date start
|
||||
ExpenseReportDateEnd=Date end
|
||||
ExpenseReportLimitAmount=Limite amount
|
||||
ExpenseReportRestrictive=Restrictive
|
||||
ExpenseReportLimitAmount=Max amount
|
||||
ExpenseReportRestrictive=Exceeding forbidden
|
||||
AllExpenseReport=All type of expense report
|
||||
OnExpense=Expense line
|
||||
ExpenseReportRuleSave=Expense report rule saved
|
||||
ExpenseReportRuleErrorOnSave=Error: %s
|
||||
RangeNum=Range %d
|
||||
ExpenseReportConstraintViolationError=Constraint violation id [%s]: %s is superior to %s %s
|
||||
ExpenseReportConstraintViolationError=Max amount exceeded (rule %s): %s is higher than %s (Exceeding forbidden)
|
||||
byEX_DAY=by day (limitation to %s)
|
||||
byEX_MON=by month (limitation to %s)
|
||||
byEX_YEA=by year (limitation to %s)
|
||||
byEX_EXP=by line (limitation to %s)
|
||||
ExpenseReportConstraintViolationWarning=Constraint violation id [%s]: %s is superior to %s %s
|
||||
ExpenseReportConstraintViolationWarning=Max amount exceeded (rule %s): %s is higher than %s (Exceeding authorized)
|
||||
nolimitbyEX_DAY=by day (no limitation)
|
||||
nolimitbyEX_MON=by month (no limitation)
|
||||
nolimitbyEX_YEA=by year (no limitation)
|
||||
|
||||
@ -89,6 +89,7 @@ CategorieRecursiv=Lier automatiquement avec le(a) tag/catégorie parent(e)
|
||||
CategorieRecursivHelp=Si l'option est activé, quand un produit est ajouté dans une sous-catégorie, le produit sera ajouté aussi dans la catégorie parente.
|
||||
AddProductServiceIntoCategory=Ajouter le produit/service suivant
|
||||
AddCustomerIntoCategory=Assigner cette catégorie au client
|
||||
AddTicketIntoCategory=Assigner cette catégorie au ticket
|
||||
AddSupplierIntoCategory=Assigner cette catégorie au fournisseur
|
||||
ShowCategory=Afficher tag/catégorie
|
||||
ByDefaultInList=Par défaut dans la liste
|
||||
|
||||
258
htdocs/partnership/admin/website.php
Normal file
258
htdocs/partnership/admin/website.php
Normal file
@ -0,0 +1,258 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@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/partnership/admin/website.php
|
||||
* \ingroup partnership
|
||||
* \brief File of main public page for partnership module
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "partnership"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setPARTNERSHIP_ENABLE_PUBLIC') {
|
||||
if (GETPOST('value')) {
|
||||
dolibarr_set_const($db, 'PARTNERSHIP_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
dolibarr_set_const($db, 'PARTNERSHIP_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update') {
|
||||
$public = GETPOST('PARTNERSHIP_ENABLE_PUBLIC');
|
||||
|
||||
$res = dolibarr_set_const($db, "PARTNERSHIP_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
//$help_url = 'EN:Module_Partnership|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('', $langs->trans("PartnershipsSetup"), $help_url);
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("PartnershipsSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = partnershipAdminPrepareHead();
|
||||
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print dol_get_fiche_head($head, 'website', $langs->trans("Partnerships"), -1, 'user');
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
function initemail()
|
||||
{
|
||||
if (jQuery("#PARTNERSHIP_NEWFORM_PAYONLINE").val()==\'-1\')
|
||||
{
|
||||
jQuery("#tremail").hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#tremail").show();
|
||||
}
|
||||
}
|
||||
function initfields()
|
||||
{
|
||||
if (jQuery("#PARTNERSHIP_ENABLE_PUBLIC").val()==\'0\')
|
||||
{
|
||||
jQuery("#trforcetype, #tramount, #tredit, #trpayment, #tremail").hide();
|
||||
}
|
||||
if (jQuery("#PARTNERSHIP_ENABLE_PUBLIC").val()==\'1\')
|
||||
{
|
||||
jQuery("#trforcetype, #tramount, #tredit, #trpayment").show();
|
||||
if (jQuery("#PARTNERSHIP_NEWFORM_PAYONLINE").val()==\'-1\') jQuery("#tremail").hide();
|
||||
else jQuery("#tremail").show();
|
||||
}
|
||||
}
|
||||
initfields();
|
||||
jQuery("#PARTNERSHIP_ENABLE_PUBLIC").change(function() { initfields(); });
|
||||
jQuery("#PARTNERSHIP_NEWFORM_PAYONLINE").change(function() { initemail(); });
|
||||
})';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("BlankSubscriptionFormDesc").'</span><br><br>';
|
||||
|
||||
$param = '';
|
||||
|
||||
$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||
if (empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setPARTNERSHIP_ENABLE_PUBLIC&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
} else {
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setPARTNERSHIP_ENABLE_PUBLIC&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
print $enabledisablehtml;
|
||||
print '<input type="hidden" id="PARTNERSHIP_ENABLE_PUBLIC" name="PARTNERSHIP_ENABLE_PUBLIC" value="'.(empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC) ? 0 : 1).'">';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Force Type
|
||||
$adht = new AdherentType($db);
|
||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||
print $langs->trans("ForceMemberType");
|
||||
print '</td><td class="right">';
|
||||
$listofval = array();
|
||||
$listofval += $adht->liste_array(1);
|
||||
$forcetype = empty($conf->global->PARTNERSHIP_NEWFORM_FORCETYPE) ? -1 : $conf->global->PARTNERSHIP_NEWFORM_FORCETYPE;
|
||||
print $form->selectarray("PARTNERSHIP_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Force nature of member (mor/phy)
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr class="oddeven drag" id="trforcenature"><td>';
|
||||
print $langs->trans("ForceMemberNature");
|
||||
print '</td><td class="right">';
|
||||
$forcenature = empty($conf->global->PARTNERSHIP_NEWFORM_FORCEMORPHY) ? 0 : $conf->global->PARTNERSHIP_NEWFORM_FORCEMORPHY;
|
||||
print $form->selectarray("PARTNERSHIP_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Amount
|
||||
print '<tr class="oddeven" id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td class="right">';
|
||||
print '<input type="text" class="right width75" id="PARTNERSHIP_NEWFORM_AMOUNT" name="PARTNERSHIP_NEWFORM_AMOUNT" value="'.(!empty($conf->global->PARTNERSHIP_NEWFORM_AMOUNT) ? $conf->global->PARTNERSHIP_NEWFORM_AMOUNT : '').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("CanEditAmount");
|
||||
print '</td><td class="right">';
|
||||
print $form->selectyesno("PARTNERSHIP_NEWFORM_EDITAMOUNT", (!empty($conf->global->PARTNERSHIP_NEWFORM_EDITAMOUNT) ? $conf->global->PARTNERSHIP_NEWFORM_EDITAMOUNT : 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="trpayment"><td>';
|
||||
print $langs->trans("PARTNERSHIP_NEWFORM_PAYONLINE");
|
||||
print '</td><td class="right">';
|
||||
$listofval = array();
|
||||
$listofval['-1'] = $langs->trans('No');
|
||||
$listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
|
||||
if (!empty($conf->paybox->enabled)) {
|
||||
$listofval['paybox'] = 'Paybox';
|
||||
}
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
$listofval['paypal'] = 'PayPal';
|
||||
}
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
$listofval['stripe'] = 'Stripe';
|
||||
}
|
||||
print $form->selectarray("PARTNERSHIP_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE) ? $conf->global->PARTNERSHIP_NEWFORM_PAYONLINE : ''), 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
if (!empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
$entity_qr = '?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
}
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
print '<div class="urllink">';
|
||||
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">';
|
||||
print '<a target="_blank" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
|
||||
print '</div>';
|
||||
print ajax_autoselect('publicurlmember');
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -131,14 +131,14 @@ class Partnership extends CommonObject
|
||||
*/
|
||||
public $rowid;
|
||||
|
||||
public $fk_soc;
|
||||
public $fk_soc; // Link to thirdparty
|
||||
public $fk_member; // Link to member
|
||||
|
||||
public $tms;
|
||||
public $fk_user_creat;
|
||||
public $fk_user_modif;
|
||||
|
||||
public $status;
|
||||
public $fk_member;
|
||||
public $date_partnership_start;
|
||||
public $date_partnership_end;
|
||||
public $count_last_url_check_error;
|
||||
|
||||
@ -46,6 +46,11 @@ function partnershipAdminPrepareHead()
|
||||
$head[$h][2] = 'partnership_extrafields';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = dol_buildpath("/partnership/admin/website.php", 1);
|
||||
$head[$h][1] = $langs->trans("BlankSubscriptionForm");
|
||||
$head[$h][2] = 'website';
|
||||
$h++;
|
||||
|
||||
/*
|
||||
$head[$h][0] = dol_buildpath("/partnership/admin/about.php", 1);
|
||||
$head[$h][1] = $langs->trans("About");
|
||||
|
||||
@ -871,7 +871,7 @@ class Productcustomerprice extends CommonObject
|
||||
$resultupd = $prodsocpricenew->create($user, 0, $forceupdateaffiliate);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $prodsocpriceupd->error;
|
||||
$this->error = $prodsocpricenew->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
|
||||
* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
|
||||
*
|
||||
* 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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
|
||||
* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
|
||||
*
|
||||
* 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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
|
||||
* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
|
||||
*
|
||||
* 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
|
||||
|
||||
@ -205,7 +205,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -1601,19 +1601,23 @@ class Project extends CommonObject
|
||||
|
||||
foreach (array('internal', 'external') as $source) {
|
||||
$tab = $origin_project->liste_contact(-1, $source);
|
||||
|
||||
foreach ($tab as $contacttoadd) {
|
||||
$clone_project->add_contact($contacttoadd['id'], $contacttoadd['code'], $contacttoadd['source'], $notrigger);
|
||||
if ($clone_project->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
$this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
|
||||
$error++;
|
||||
} else {
|
||||
if ($clone_project->error != '') {
|
||||
$this->error .= $clone_project->error;
|
||||
if (is_array($tab) && count($tab)>0) {
|
||||
foreach ($tab as $contacttoadd) {
|
||||
$clone_project->add_contact($contacttoadd['id'], $contacttoadd['code'], $contacttoadd['source'], $notrigger);
|
||||
if ($clone_project->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
$this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
|
||||
$error++;
|
||||
} else {
|
||||
if ($clone_project->error != '') {
|
||||
$this->error .= $clone_project->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($tab < 0) {
|
||||
$this->error .= $origin_project->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1660,7 +1664,7 @@ class Project extends CommonObject
|
||||
foreach ($tasksarray as $tasktoclone) {
|
||||
$result_clone = $taskstatic->createFromClone($user, $tasktoclone->id, $clone_project_id, $tasktoclone->fk_parent, $move_date, true, false, $clone_task_file, true, false);
|
||||
if ($result_clone <= 0) {
|
||||
$this->error .= $result_clone->error;
|
||||
$this->error .= $taskstatic->error;
|
||||
$error++;
|
||||
} else {
|
||||
$new_task_id = $result_clone;
|
||||
@ -1714,6 +1718,7 @@ class Project extends CommonObject
|
||||
global $user, $langs, $conf;
|
||||
|
||||
$error = 0;
|
||||
$result = 0;
|
||||
|
||||
$taskstatic = new Task($this->db);
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ if ($action == 'addcontact') {
|
||||
foreach ($task_array as $task) {
|
||||
$task_already_affected=false;
|
||||
$personsLinked = $task->liste_contact(-1, $source);
|
||||
if (!is_array($personsLinked) && coun($personsLinked) < 0) {
|
||||
if (!is_array($personsLinked) && count($personsLinked) < 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
} else {
|
||||
foreach ($personsLinked as $person) {
|
||||
|
||||
@ -404,8 +404,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
// Third party
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
|
||||
if ($projectstatic->societe->id) {
|
||||
print $projectstatic->societe->getNomUrl(1);
|
||||
if ($projectstatic->thirdparty->id) {
|
||||
print $projectstatic->thirdparty->getNomUrl(1);
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
|
||||
26
htdocs/public/partnership/index.php
Normal file
26
htdocs/public/partnership/index.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/public/partnership/index.php
|
||||
* \ingroup core
|
||||
* \brief A redirect page to an error
|
||||
*/
|
||||
|
||||
require '../../master.inc.php';
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/public/error-404.php');
|
||||
620
htdocs/public/partnership/new.php
Normal file
620
htdocs/public/partnership/new.php
Normal file
@ -0,0 +1,620 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* 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/public/partnership/new.php
|
||||
* \ingroup member
|
||||
* \brief Example of form to add a new member
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
// Init vars
|
||||
$errmsg = '';
|
||||
$num = 0;
|
||||
$error = 0;
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Load translation files
|
||||
$langs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->partnership->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
if (empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
|
||||
print $langs->trans("Auto subscription form for public visitors has not been enabled");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('publicnewpartnershipcard', 'globalcard'));
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
$object = new Partnership($db);
|
||||
|
||||
$user->loadDefaultValues();
|
||||
|
||||
|
||||
/**
|
||||
* Show header for new partnership
|
||||
*
|
||||
* @param string $title Title
|
||||
* @param string $head Head array
|
||||
* @param int $disablejs More content into html header
|
||||
* @param int $disablehead More content into html header
|
||||
* @param array $arrayofjs Array of complementary js files
|
||||
* @param array $arrayofcss Array of complementary css files
|
||||
* @return void
|
||||
*/
|
||||
function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
|
||||
{
|
||||
global $user, $conf, $langs, $mysoc;
|
||||
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
|
||||
|
||||
print '<body id="mainbody" class="publicnewmemberform">';
|
||||
|
||||
// Define urllogo
|
||||
$urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
|
||||
|
||||
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
|
||||
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo);
|
||||
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
|
||||
$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
|
||||
}
|
||||
|
||||
print '<div class="center">';
|
||||
|
||||
// Output html code for logo
|
||||
if ($urllogo) {
|
||||
print '<div class="backgreypublicpayment">';
|
||||
print '<div class="logopublicpayment">';
|
||||
print '<img id="dolpaymentlogo" src="'.$urllogo.'">';
|
||||
print '</div>';
|
||||
if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
|
||||
print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION)) {
|
||||
print '<div class="backimagepublicregistration">';
|
||||
print '<img id="idPARTNERSHIP_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION.'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="divmainbodylarge">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Show footer for new member
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function llxFooterVierge()
|
||||
{
|
||||
print '</div>';
|
||||
|
||||
printCommonFooter('public');
|
||||
|
||||
print "</body>\n";
|
||||
print "</html>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
$parameters = array();
|
||||
// Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
// Action called when page is submitted
|
||||
if (empty($reshook) && $action == 'add') {
|
||||
$error = 0;
|
||||
$urlback = '';
|
||||
|
||||
$db->begin();
|
||||
|
||||
/*if (GETPOST('typeid') <= 0) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."<br>\n";
|
||||
}*/
|
||||
if (!GETPOST('lastname')) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
|
||||
}
|
||||
if (!GETPOST('firstname')) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
|
||||
}
|
||||
if (empty(GETPOST('email'))) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Email'))."<br>\n";
|
||||
} elseif (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
|
||||
$langs->load('errors');
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
|
||||
}
|
||||
|
||||
$public = GETPOSTISSET('public') ? 1 : 0;
|
||||
|
||||
if (!$error) {
|
||||
$partnership = new Partnership($db);
|
||||
|
||||
// We try to find the thirdparty or the member
|
||||
if (empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) || $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'thirdparty') {
|
||||
|
||||
|
||||
$partnership->fk_member = 0;
|
||||
} elseif ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
|
||||
|
||||
|
||||
$partnership->fk_soc = 0;
|
||||
}
|
||||
|
||||
$partnership->statut = -1;
|
||||
$partnership->firstname = GETPOST('firstname');
|
||||
$partnership->lastname = GETPOST('lastname');
|
||||
$partnership->address = GETPOST('address');
|
||||
$partnership->zip = GETPOST('zipcode');
|
||||
$partnership->town = GETPOST('town');
|
||||
$partnership->email = GETPOST('email');
|
||||
$partnership->country_id = GETPOST('country_id', 'int');
|
||||
$partnership->state_id = GETPOST('state_id', 'int');
|
||||
//$partnership->typeid = $conf->global->PARTNERSHIP_NEWFORM_FORCETYPE ? $conf->global->PARTNERSHIP_NEWFORM_FORCETYPE : GETPOST('typeid', 'int');
|
||||
$partnership->note_private = GETPOST('note_private');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$extrafields->fetch_name_optionals_label($partnership->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $partnership);
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$result = $partnership->create($user);
|
||||
if ($result > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$object = $partnership;
|
||||
|
||||
/*
|
||||
$partnershipt = new PartnershipType($db);
|
||||
$partnershipt->fetch($object->typeid);
|
||||
|
||||
if ($object->email) {
|
||||
$subject = '';
|
||||
$msg = '';
|
||||
|
||||
// Send subscription email
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
// Set output language
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->PARTNERSHIP_EMAIL_TEMPLATE_AUTOREGISTER;
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
}
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $partnershipt->getMailOnValid()), $substitutionarray, $outputlangs);
|
||||
|
||||
if ($subjecttosend && $texttosend) {
|
||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Send email to the foundation to say a new member subscribed with autosubscribe form
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->PARTNERSHIP_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
|
||||
!empty($conf->global->PARTNERSHIP_AUTOREGISTER_NOTIF_MAIL)) {
|
||||
// Define link to login card
|
||||
$appli = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (preg_match('/\d\.\d/', $appli)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
|
||||
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
|
||||
$to = $partnership->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
|
||||
$from = $conf->global->PARTNERSHIP_MAIL_FROM;
|
||||
$mailfile = new CMailFile(
|
||||
'['.$appli.'] '.$conf->global->PARTNERSHIP_AUTOREGISTER_NOTIF_MAIL_SUBJECT,
|
||||
$to,
|
||||
$from,
|
||||
$partnership->makeSubstitution($conf->global->PARTNERSHIP_AUTOREGISTER_NOTIF_MAIL),
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
-1
|
||||
);
|
||||
|
||||
if (!$mailfile->sendfile()) {
|
||||
dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($backtopage)) {
|
||||
$urlback = $backtopage;
|
||||
} elseif (!empty($conf->global->PARTNERSHIP_URL_REDIRECT_SUBSCRIPTION)) {
|
||||
$urlback = $conf->global->PARTNERSHIP_URL_REDIRECT_SUBSCRIPTION;
|
||||
// TODO Make replacement of __AMOUNT__, etc...
|
||||
} else {
|
||||
$urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE) && $conf->global->PARTNERSHIP_NEWFORM_PAYONLINE != '-1') {
|
||||
if ($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE == 'all') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=partnershipnewform&source=membersubscription&ref='.urlencode($partnership->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$partnership->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE == 'paybox') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=partnershipnewform&source=membersubscription&ref='.urlencode($partnership->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$partnership->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE == 'paypal') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=partnershipnewform&source=membersubscription&ref='.urlencode($partnership->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$partnership->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE == 'stripe') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=partnershipnewform&source=membersubscription&ref='.$partnership->ref;
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$partnership->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error('', "Autosubscribe form is setup to ask an online payment for a not managed online payment");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($entity)) {
|
||||
$urlback .= '&entity='.$entity;
|
||||
}
|
||||
dol_syslog("partnership ".$partnership->ref." was created, we redirect to ".$urlback);
|
||||
} else {
|
||||
$error++;
|
||||
$errmsg .= join('<br>', $partnership->errors);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
|
||||
Header("Location: ".$urlback);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
// Action called after a submitted was send and member created successfully
|
||||
// If PARTNERSHIP_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url.
|
||||
// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
|
||||
if (empty($reshook) && $action == 'added') {
|
||||
llxHeaderVierge($langs->trans("NewPartnershipForm"));
|
||||
|
||||
// Si on a pas ete redirige
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print $langs->trans("NewPartnershipbyWeb");
|
||||
print '</div>';
|
||||
|
||||
llxFooterVierge();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$partnershipt = new AdherentType($db);
|
||||
$extrafields->fetch_name_optionals_label('partnership'); // fetch optionals attributes and labels
|
||||
|
||||
|
||||
llxHeaderVierge($langs->trans("NewSubscription"));
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("NewSubscription"), '', '', 0, 0, 'center');
|
||||
|
||||
|
||||
print '<div align="center">';
|
||||
print '<div id="divsubscribe">';
|
||||
|
||||
print '<div class="center subscriptionformhelptext justify">';
|
||||
if (!empty($conf->global->PARTNERSHIP_NEWFORM_TEXT)) {
|
||||
print $langs->trans($conf->global->PARTNERSHIP_NEWFORM_TEXT)."<br>\n";
|
||||
} else {
|
||||
print $langs->trans("NewSubscriptionDesc", $conf->global->MAIN_INFO_SOCIETE_MAIL)."<br>\n";
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
dol_htmloutput_errors($errmsg);
|
||||
|
||||
// Print form
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" / >';
|
||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||
print '<input type="hidden" name="action" value="add" />';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
|
||||
//print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
|
||||
|
||||
print dol_get_fiche_head('');
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.newmember.action.value="create";
|
||||
document.newmember.submit();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
|
||||
|
||||
// Type
|
||||
/*
|
||||
if (empty($conf->global->PARTNERSHIP_NEWFORM_FORCETYPE)) {
|
||||
$listoftype = $partnershipt->liste_array();
|
||||
$tmp = array_keys($listoftype);
|
||||
$defaulttype = '';
|
||||
$isempty = 1;
|
||||
if (count($listoftype) == 1) {
|
||||
$defaulttype = $tmp[0];
|
||||
$isempty = 0;
|
||||
}
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").' <span style="color: red">*</span></td><td>';
|
||||
print $form->selectarray("typeid", $partnershipt->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty);
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
$partnershipt->fetch($conf->global->PARTNERSHIP_NEWFORM_FORCETYPE);
|
||||
print '<input type="hidden" id="typeid" name="typeid" value="'.$conf->global->PARTNERSHIP_NEWFORM_FORCETYPE.'">';
|
||||
}
|
||||
*/
|
||||
|
||||
// Moral/Physic attribute
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
if (empty($conf->global->PARTNERSHIP_NEWFORM_FORCEMORPHY)) {
|
||||
print '<tr class="morphy"><td class="titlefield">'.$langs->trans('MemberNature').' <span style="color: red">*</span></td><td>'."\n";
|
||||
print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print $morphys[$conf->global->PARTNERSHIP_NEWFORM_FORCEMORPHY];
|
||||
print '<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->PARTNERSHIP_NEWFORM_FORCEMORPHY.'">';
|
||||
}
|
||||
|
||||
// Company
|
||||
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
print '<input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
|
||||
// Title
|
||||
print '<tr><td class="titlefield">'.$langs->trans('UserTitle').'</td><td>';
|
||||
print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'</td></tr>'."\n";
|
||||
// Lastname
|
||||
print '<tr><td>'.$langs->trans("Lastname").' <span style="color: red">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
|
||||
// Firstname
|
||||
print '<tr><td>'.$langs->trans("Firstname").' <span style="color: red">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("Email").($conf->global->PARTNERSHIP_MAIL_REQUIRED ? ' <span style="color:red;">*</span>' : '').'</td><td>';
|
||||
//print img_picto('', 'email', 'class="pictofixedwidth"');
|
||||
print '<input type="text" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
||||
// Login
|
||||
if (empty($conf->global->PARTNERSHIP_LOGIN_NOT_REQUIRED)) {
|
||||
print '<tr><td>'.$langs->trans("Login").' <span style="color: red">*</span></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Password").' <span style="color: red">*</span></td><td><input type="password" maxlength="128" name="pass1" class="minwidth100" value="'.GETPOST("pass1", "nohtml").'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("PasswordAgain").' <span style="color: red">*</span></td><td><input type="password" maxlength="128" name="pass2" class="minwidth100" value="'.GETPOST("pass2", "nohtml").'"></td></tr>'."\n";
|
||||
}
|
||||
// Gender
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1);
|
||||
print '</td></tr>';
|
||||
// Address
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
|
||||
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
|
||||
print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
|
||||
print ' / ';
|
||||
print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
|
||||
print '</td></tr>';
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td>';
|
||||
print img_picto('', 'country', 'class="pictofixedwidth"');
|
||||
$country_id = GETPOST('country_id', 'int');
|
||||
if (!$country_id && !empty($conf->global->PARTNERSHIP_NEWFORM_FORCECOUNTRYCODE)) {
|
||||
$country_id = getCountry($conf->global->PARTNERSHIP_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
|
||||
}
|
||||
if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
|
||||
$country_code = dol_user_country();
|
||||
//print $country_code;
|
||||
if ($country_code) {
|
||||
$new_country_id = getCountry($country_code, 3, $db, $langs);
|
||||
//print 'xxx'.$country_code.' - '.$new_country_id;
|
||||
if ($new_country_id) {
|
||||
$country_id = $new_country_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
$country_code = getCountry($country_id, 2, $db, $langs);
|
||||
print $form->select_country($country_id, 'country_id');
|
||||
print '</td></tr>';
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($country_code) {
|
||||
print $formcompany->select_state(GETPOST("state_id"), $country_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Logo
|
||||
//print '<tr><td>'.$langs->trans("URLPhoto").'</td><td><input type="text" name="photo" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
|
||||
// Other attributes
|
||||
$tpl_context = 'public'; // define template context to public
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
||||
// Comments
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
|
||||
print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private', 'restricthtml'), 0, 1).'</textarea></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
// Save
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
|
||||
if (!empty($backtopage)) {
|
||||
print ' <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
print "</form>\n";
|
||||
print "<br>";
|
||||
print '</div></div>';
|
||||
|
||||
|
||||
llxFooterVierge();
|
||||
|
||||
$db->close();
|
||||
@ -246,7 +246,7 @@ $sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -326,22 +326,14 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
$text = $langs->trans('SellingPrice');
|
||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||
print '</td><td>';
|
||||
if ($object->price_base_type == 'TTC') {
|
||||
print '<input name="price" size="10" value="'.price($object->price_ttc).'">';
|
||||
} else {
|
||||
print '<input name="price" size="10" value="'.price($object->price).'">';
|
||||
}
|
||||
print '<input name="price" size="10" value="'.GETPOST('price', 'int').'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Price minimum
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans('MinPrice');
|
||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||
if ($object->price_base_type == 'TTC') {
|
||||
print '<td><input name="price_min" size="10" value="'.price($object->price_min_ttc).'">';
|
||||
} else {
|
||||
print '<td><input name="price_min" size="10" value="'.price($object->price_min).'">';
|
||||
}
|
||||
print '<td><input name="price_min" size="10" value="'.GETPOST('price_min', 'int').'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Update all child soc
|
||||
|
||||
@ -256,8 +256,7 @@ print "</tr>\n";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("NumberOfTerminals");
|
||||
print '<td colspan="2">';
|
||||
$array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6", 7=>"7", 8=>"8", 9=>"9");
|
||||
print $form->selectarray('TAKEPOS_NUM_TERMINALS', $array, (empty($conf->global->TAKEPOS_NUM_TERMINALS) ? '0' : $conf->global->TAKEPOS_NUM_TERMINALS), 0);
|
||||
print '<input type="number" name="TAKEPOS_NUM_TERMINALS" min="1" value="' . (empty($conf->global->TAKEPOS_NUM_TERMINALS) ? '1' : $conf->global->TAKEPOS_NUM_TERMINALS) . '">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Services
|
||||
|
||||
@ -277,7 +277,7 @@ a.btnTitle.btnTitleSelected {
|
||||
}
|
||||
|
||||
.btnTitle>.fa {
|
||||
font-size: 20px;
|
||||
font-size: 2em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
@ -532,6 +532,16 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_categories' && $user->rights->ticket->write) {
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$result = $object->setCategories(GETPOST('categories', 'array'));
|
||||
|
||||
$url = 'card.php?action=view&track_id='.$object->track_id;
|
||||
header("Location: ".$url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setsubject' && $user->rights->ticket->write) {
|
||||
if ($object->fetch(GETPOST('id', 'int'))) {
|
||||
if ($action == 'setsubject') {
|
||||
@ -787,7 +797,7 @@ if ($action == 'create' || $action == 'presend') {
|
||||
print $form->buttonsSaveCancel();
|
||||
|
||||
print '</form>'; */
|
||||
} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'abandon' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'
|
||||
} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'abandon' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'categories' || $action == 'reopen'
|
||||
|| $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') {
|
||||
if ($res > 0) {
|
||||
// or for unauthorized internals users
|
||||
@ -1101,9 +1111,43 @@ if ($action == 'create' || $action == 'presend') {
|
||||
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
|
||||
print "</td></tr>";
|
||||
print '<tr>';
|
||||
print '<td class="valignmiddle">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
|
||||
print $langs->trans("Categories");
|
||||
if ($action != 'categories' && !$user->socid) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=categories&track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</td>';
|
||||
|
||||
if ($user->rights->ticket->write && $action == 'categories') {
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
|
||||
if (count($cate_arbo)) {
|
||||
// Categories
|
||||
print '<td colspan="3">';
|
||||
print '<form action="'.$url_page_current.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="track_id" value="'.$track_id.'">';
|
||||
print '<input type="hidden" name="action" value="set_categories">';
|
||||
|
||||
$category = new Categorie($db);
|
||||
$cats = $category->containing($object->id, 'ticket');
|
||||
$arrayselected = array();
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Save').'">';
|
||||
print '</form>';
|
||||
print "</td>";
|
||||
}
|
||||
} else {
|
||||
print '<td colspan="3">';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file scripts/website/regenerate_pages.php
|
||||
* \file scripts/website/regenerate-pages.php
|
||||
* \ingroup scripts
|
||||
* \brief Regenerate all pages of a web site
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user