mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 12:01:23 +01:00
Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -379,7 +379,7 @@ $tabrowid[9] = "code_iso";
|
||||
$tabrowid[10]= "";
|
||||
$tabrowid[11]= "rowid";
|
||||
$tabrowid[12]= "";
|
||||
$tabrowid[13]= "";
|
||||
$tabrowid[13]= "id";
|
||||
$tabrowid[14]= "";
|
||||
$tabrowid[15]= "";
|
||||
$tabrowid[16]= "code";
|
||||
|
||||
@@ -556,7 +556,7 @@ foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||
}
|
||||
else if ($tmpfieldlist == 'joinfiles') {
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1') . '">';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1327,7 +1327,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
||||
|
||||
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
|
||||
$nextindextouse=count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
|
||||
$nextindextouse=is_array($colorindexused)?count($colorindexused):0; // At first run this is 0, so fist user has 0, next 1, ...
|
||||
//var_dump($colorindexused);
|
||||
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
|
||||
@@ -4730,7 +4730,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// For situation invoice with excess received
|
||||
if ($object->statut == Facture::STATUS_VALIDATED
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
|
||||
&& $user->rights->facture->creer
|
||||
&& !$objectidnext
|
||||
@@ -4748,7 +4748,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// remove situation from cycle
|
||||
if ($object->statut == Facture::STATUS_VALIDATED
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
&& $user->rights->facture->creer
|
||||
&& !$objectidnext
|
||||
|
||||
@@ -984,6 +984,7 @@ class FactureRec extends CommonInvoice
|
||||
$error=0;
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load('main');
|
||||
|
||||
$nb_create=0;
|
||||
|
||||
@@ -1060,6 +1061,8 @@ class FactureRec extends CommonInvoice
|
||||
}
|
||||
if (! $error && $facturerec->generate_pdf)
|
||||
{
|
||||
// We refresh the object in order to have all necessary data (like date_lim_reglement)
|
||||
$facture->fetch($facture->id);
|
||||
$result = $facture->generateDocument($facturerec->modelpdf, $langs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
|
||||
@@ -838,7 +838,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
|
||||
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
|
||||
|
||||
|
||||
@@ -3327,21 +3327,21 @@ class Form
|
||||
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||
// Last seen cycle
|
||||
$ref = 0;
|
||||
while ($res = $this->db->fetch_array($resql, MYSQL_NUM)) {
|
||||
while ($obj = $this->db->fetch_object($resql)){
|
||||
//Same company ?
|
||||
if ($socid == $res[5]) {
|
||||
if ($socid == $obj->fk_soc) {
|
||||
//Same cycle ?
|
||||
if ($res[2] != $ref) {
|
||||
if ($obj->situation_cycle_ref != $ref) {
|
||||
// Just seen this cycle
|
||||
$ref = $res[2];
|
||||
$ref = $obj->situation_cycle_ref;
|
||||
//not final ?
|
||||
if ($res[4] != 1) {
|
||||
if ($obj->situation_final != 1) {
|
||||
//Not prov?
|
||||
if (substr($res[1], 1, 4) != 'PROV') {
|
||||
if ($selected == $res[0]) {
|
||||
$opt .= '<option value="' . $res[0] . '" selected>' . $res[1] . '</option>';
|
||||
if (substr($obj->facnumber, 1, 4) != 'PROV') {
|
||||
if ($selected == $obj->situation_final) {
|
||||
$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->facnumber . '</option>';
|
||||
} else {
|
||||
$opt .= '<option value="' . $res[0] . '">' . $res[1] . '</option>';
|
||||
$opt .= '<option value="' . $obj->rowid . '">' . $obj->facnumber . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,10 +487,10 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu
|
||||
elseif ($reg[1] == 'MONTH') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mon']; }
|
||||
elseif ($reg[1] == 'YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['year']; }
|
||||
elseif ($reg[1] == 'PREVIOUS_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
|
||||
elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
||||
elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
||||
elseif ($reg[1] == 'PREVIOUS_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] - 1); }
|
||||
elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
|
||||
elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
||||
elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
||||
elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); }
|
||||
elseif ($reg[1] == 'MYCOMPANY_COUNTRY_ID' || $reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID')
|
||||
{
|
||||
@@ -5520,7 +5520,7 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UT
|
||||
function dol_string_onlythesehtmltags($stringtoclean)
|
||||
{
|
||||
$allowed_tags = array(
|
||||
"html", "head", "meta", "body", "b", "br", "div", "em", "font", "img", "ins", "hr", "i", "li", "link",
|
||||
"html", "head", "meta", "body", "article", "a", "b", "br", "div", "em", "font", "img", "ins", "hr", "i", "li", "link",
|
||||
"ol", "p", "s", "section", "span", "strong", "title",
|
||||
"table", "tr", "th", "td", "u", "ul"
|
||||
);
|
||||
@@ -6139,9 +6139,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
|
||||
$tmp=dol_getdate(dol_now(), true);
|
||||
$tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']);
|
||||
$tmp3=dol_get_prev_month($tmp['mday'], $tmp['mon'], $tmp['year']);
|
||||
$tmp3=dol_get_prev_month($tmp['mon'], $tmp['year']);
|
||||
$tmp4=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']);
|
||||
$tmp5=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']);
|
||||
$tmp5=dol_get_next_month($tmp['mon'], $tmp['year']);
|
||||
|
||||
$substitutionarray=array_merge($substitutionarray, array(
|
||||
'__DAY__' => (string) $tmp['mday'],
|
||||
|
||||
@@ -550,7 +550,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent."%", 0, 'R');
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent, 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
|
||||
@@ -193,6 +193,21 @@ if ($action == 'presend')
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters);
|
||||
|
||||
// Find the good contact adress
|
||||
$custcontact = '';
|
||||
$contactarr = array();
|
||||
$contactarr = $object->liste_contact(- 1, 'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr) > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
foreach ($contactarr as $contact) {
|
||||
$contactstatic->fetch($contact['id']);
|
||||
$substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($langs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->substit = $substitutionarray;
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (filepath, filename, ent
|
||||
DROP TABLE llx_c_accountancy_category;
|
||||
DROP TABLE llx_c_accountingaccount;
|
||||
|
||||
-- drop old postgresql unique key
|
||||
-- VPGSQL8.2 DROP INDEX llx_usergroup_rights_fk_usergroup_fk_id_key
|
||||
|
||||
update llx_propal set fk_statut = 1 where fk_statut = -1;
|
||||
|
||||
ALTER TABLE llx_inventory ADD COLUMN fk_user_creat integer;
|
||||
|
||||
@@ -1078,15 +1078,28 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
|
||||
|
||||
if ($db->type == "mysql" || $db->type == "mysqli")
|
||||
{
|
||||
$force_utf8_on_tables = GETPOST('force_utf8_on_tables','alpha');
|
||||
|
||||
$listoftables = $db->DDLListTables($db->database_name);
|
||||
|
||||
// Disable foreign key checking for avoid errors
|
||||
if ($force_utf8_on_tables == 'confirmed')
|
||||
{
|
||||
$sql='SET FOREIGN_KEY_CHECKS=0';
|
||||
print '<!-- '.$sql.' -->';
|
||||
$resql = $db->query($sql);
|
||||
}
|
||||
|
||||
foreach($listoftables as $table)
|
||||
{
|
||||
// do not convert llx_const if mysql encrypt/decrypt is used
|
||||
if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table)) continue;
|
||||
|
||||
print '<tr><td colspan="2">';
|
||||
print $table;
|
||||
$sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';
|
||||
print '<!-- '.$sql.' -->';
|
||||
if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed')
|
||||
if ($force_utf8_on_tables == 'confirmed')
|
||||
{
|
||||
$resql = $db->query($sql);
|
||||
print ' - Done ('.($resql?'OK':'KO').')';
|
||||
@@ -1094,6 +1107,14 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
|
||||
else print ' - Disabled';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Enable foreign key checking
|
||||
if ($force_utf8_on_tables == 'confirmed')
|
||||
{
|
||||
$sql='SET FOREIGN_KEY_CHECKS=1';
|
||||
print '<!-- '.$sql.' -->';
|
||||
$resql = $db->query($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1796,7 +1796,7 @@ EnterCalculationRuleIfPreviousFieldIsYes=Enter calculation rule if previous fiel
|
||||
SeveralLangugeVariatFound=Several language variants found
|
||||
COMPANY_AQUARIUM_REMOVE_SPECIAL=Remove special characters
|
||||
COMPANY_AQUARIUM_CLEAN_REGEX=Regex filter to clean value (COMPANY_AQUARIUM_CLEAN_REGEX)
|
||||
GDPRContact=GDPR contact
|
||||
GDPRContact=Privacy Policies or GDPR contact
|
||||
GDPRContactDesc=If you store data about European companies/citizen, you can store here the contact who is responsible for the General Data Protection Regulation
|
||||
HelpOnTooltip=Help text to show on tooltip
|
||||
HelpOnTooltipDesc=Put here a text or a translation key for a text to show on a tooltip when this field appears into a form
|
||||
|
||||
@@ -142,6 +142,7 @@ Closed=Closed
|
||||
Closed2=Closed
|
||||
NotClosed=Not closed
|
||||
Enabled=Enabled
|
||||
Enable=Enable
|
||||
Deprecated=Deprecated
|
||||
Disable=Disable
|
||||
Disabled=Disabled
|
||||
|
||||
@@ -299,7 +299,7 @@ $sql.= ' ,'.$sqldesiredtock.' as desiredstock, '.$sqlalertstock.' as alertstock,
|
||||
$sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique';
|
||||
$sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
|
||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
|
||||
$sql.= ' ON p.rowid = s.fk_product';
|
||||
$sql.= ' ON (p.rowid = s.fk_product AND s.fk_entrepot IN (SELECT ent.rowid FROM '.MAIN_DB_PREFIX.'entrepot AS ent WHERE ent.entity IN('.getEntity('stock').')))';
|
||||
if($fk_supplier > 0) {
|
||||
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')';
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
|
||||
|
||||
$langs->loadLangs(array("companies","commercial","banks","bills",'paypal','stripe'));
|
||||
$langs->loadLangs(array("companies","commercial","banks","bills",'paypal','stripe','withdrawals'));
|
||||
|
||||
|
||||
// Security check
|
||||
|
||||
@@ -3743,6 +3743,8 @@ tr.visible {
|
||||
border: 0px;
|
||||
background-color: transparent;
|
||||
background-image: none;
|
||||
color: #000 !important;
|
||||
text-shadow: none;
|
||||
}
|
||||
.websitebar {
|
||||
border-bottom: 1px solid #ccc;
|
||||
|
||||
@@ -67,7 +67,7 @@ class Users extends DolibarrApi
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
se
|
||||
if(! DolibarrApiAccess::$user->rights->user->user->lire) {
|
||||
throw new RestException(401, "You are not allowed to read list of users");
|
||||
}
|
||||
@@ -227,7 +227,7 @@ class Users extends DolibarrApi
|
||||
}
|
||||
|
||||
/**
|
||||
* add user to group
|
||||
* Add a user into a group
|
||||
*
|
||||
* @param int $id User ID
|
||||
* @param int $group Group ID
|
||||
@@ -236,6 +236,9 @@ class Users extends DolibarrApi
|
||||
* @url GET {id}/setGroup/{group}
|
||||
*/
|
||||
function setGroup($id, $group) {
|
||||
|
||||
global $conf;
|
||||
|
||||
//if (!DolibarrApiAccess::$user->rights->user->user->supprimer) {
|
||||
//throw new RestException(401);
|
||||
//}
|
||||
@@ -250,7 +253,9 @@ class Users extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->useraccount->SetInGroup($group,1);
|
||||
// When using API, action is done on entity of logged user because a user of entity X with permission to create user should not be able to
|
||||
// hack the security by giving himself permissions on another entity.
|
||||
$result = $this->useraccount->SetInGroup($group, DolibarrApiAccess::$user->entity > 0 ? DolibarrApiAccess::$user->entity : $conf->entity);
|
||||
if (! ($result > 0))
|
||||
{
|
||||
throw new RestException(500, $this->useraccount->error);
|
||||
|
||||
Reference in New Issue
Block a user