forked from Wavyzz/dolibarr
Compare commits
74 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4601686a6 | ||
|
|
bcf6d6a7a2 | ||
|
|
e818bf732d | ||
|
|
e18c5b9d68 | ||
|
|
031acacdab | ||
|
|
18725aec6b | ||
|
|
f256deb54b | ||
|
|
7fa3474ecd | ||
|
|
fa05dc44ce | ||
|
|
5b9453e302 | ||
|
|
d81a2d060e | ||
|
|
97aaff7395 | ||
|
|
6f4b2a8905 | ||
|
|
e1c343cedd | ||
|
|
b67fdb3e51 | ||
|
|
ad60a50d4d | ||
|
|
08a976fd85 | ||
|
|
db47ce3bb1 | ||
|
|
04fed9526a | ||
|
|
5354b54ec0 | ||
|
|
42d8591758 | ||
|
|
abc1d1dcb3 | ||
|
|
628189f57f | ||
|
|
748dcd0881 | ||
|
|
7a7146c03d | ||
|
|
90c24b3d95 | ||
|
|
0912b3b04f | ||
|
|
2dd81deb13 | ||
|
|
273ec857a3 | ||
|
|
2519278269 | ||
|
|
74881ae251 | ||
|
|
a5f51dc969 | ||
|
|
04b7fdd4c4 | ||
|
|
5203652796 | ||
|
|
425c23d28c | ||
|
|
115323dec8 | ||
|
|
b8533e1853 | ||
|
|
753e5e535d | ||
|
|
a602309e04 | ||
|
|
f51935a258 | ||
|
|
fbca98ec2a | ||
|
|
93f23fe452 | ||
|
|
8a55e2f6a4 | ||
|
|
e0a3756c6e | ||
|
|
b3a2908b48 | ||
|
|
910f7e8564 | ||
|
|
7cf1a97673 | ||
|
|
cf57e7e88b | ||
|
|
a186e16568 | ||
|
|
793e77bc5f | ||
|
|
70a453a5c2 | ||
|
|
9509929f5d | ||
|
|
336d3ad8e5 | ||
|
|
e71631abe0 | ||
|
|
25ea797aed | ||
|
|
d0fb08adf4 | ||
|
|
624493fb26 | ||
|
|
6eddee9a78 | ||
|
|
52138372ce | ||
|
|
a27538f582 | ||
|
|
385927fe06 | ||
|
|
a621032643 | ||
|
|
32646cb7f4 | ||
|
|
74b67eb6c6 | ||
|
|
8a330ecaa9 | ||
|
|
eef0d0bddb | ||
|
|
c1889afd7b | ||
|
|
644f365455 | ||
|
|
667890247c | ||
|
|
c727bbb530 | ||
|
|
16a0d1d7d5 | ||
|
|
bb40a43c5f | ||
|
|
171494ddfc | ||
|
|
9f5ef68123 |
@@ -103,7 +103,9 @@ if ($action == "set") {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
} elseif (!$error) {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
|
||||
@@ -736,7 +736,50 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
|
||||
}
|
||||
|
||||
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
|
||||
$disablevirusscan = 0;
|
||||
$src_file = $destfiletmp;
|
||||
$dest_file = $destfile;
|
||||
|
||||
// Security:
|
||||
// If we need to make a virus scan
|
||||
if (empty($disablevirusscan) && file_exists($src_file)) {
|
||||
$checkvirusarray = dolCheckVirus($src_file);
|
||||
if (count($checkvirusarray)) {
|
||||
dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING);
|
||||
throw new RestException(500, 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray));
|
||||
}
|
||||
}
|
||||
|
||||
// Security:
|
||||
// Disallow file with some extensions. We rename them.
|
||||
// Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code.
|
||||
if (isAFileWithExecutableContent($dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) {
|
||||
// $upload_dir ends with a slash, so be must be sure the medias dir to compare to ends with slash too.
|
||||
$publicmediasdirwithslash = $conf->medias->multidir_output[$conf->entity];
|
||||
if (!preg_match('/\/$/', $publicmediasdirwithslash)) {
|
||||
$publicmediasdirwithslash .= '/';
|
||||
}
|
||||
|
||||
if (strpos($upload_dir, $publicmediasdirwithslash) !== 0 || !getDolGlobalInt("MAIN_DOCUMENT_DISABLE_NOEXE_IN_MEDIAS_DIR")) { // We never add .noexe on files into media directory
|
||||
$dest_file .= '.noexe';
|
||||
}
|
||||
}
|
||||
|
||||
// Security:
|
||||
// We refuse cache files/dirs, upload using .. and pipes into filenames.
|
||||
if (preg_match('/^\./', basename($src_file)) || preg_match('/\.\./', $src_file) || preg_match('/[<>|]/', $src_file)) {
|
||||
dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING);
|
||||
throw new RestException(500, "Refused to deliver file ".$src_file);
|
||||
}
|
||||
|
||||
// Security:
|
||||
// We refuse cache files/dirs, upload using .. and pipes into filenames.
|
||||
if (preg_match('/^\./', basename($dest_file)) || preg_match('/\.\./', $dest_file) || preg_match('/[<>|]/', $dest_file)) {
|
||||
dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING);
|
||||
throw new RestException(500, "Refused to deliver file ".$dest_file);
|
||||
}
|
||||
|
||||
$result = dol_move($destfiletmp, $dest_file, 0, $overwriteifexists, 1, 1);
|
||||
if (!$result) {
|
||||
throw new RestException(500, "Failed to move file into '".$destfile."'");
|
||||
}
|
||||
|
||||
@@ -986,7 +986,7 @@ class BOM extends CommonObject
|
||||
$outputlangs->load("products");
|
||||
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'standard';
|
||||
$modele = '';
|
||||
|
||||
if ($this->model_pdf) {
|
||||
$modele = $this->model_pdf;
|
||||
|
||||
@@ -1233,8 +1233,14 @@ if ($action == 'create') {
|
||||
$preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int');
|
||||
}
|
||||
if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int');
|
||||
// select "all" or "none" contact by default
|
||||
if (getDolGlobalInt('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT')) {
|
||||
$select_contact_default = 0; // select "all" contacts by default : avoid to use it if there is a lot of contacts
|
||||
} else {
|
||||
$select_contact_default = -1; // select "none" by default
|
||||
}
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"');
|
||||
print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
|
||||
print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -1728,7 +1734,12 @@ if ($id > 0) {
|
||||
// related contact
|
||||
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
|
||||
if (getDolGlobalInt('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT')) {
|
||||
$select_contact_default = 0; // select "all" contacts by default : avoid to use it if there is a lot of contacts
|
||||
} else {
|
||||
$select_contact_default = -1; // select "none" by default
|
||||
}
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(!empty($object->socid) ? $object->socid : $select_contact_default, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -1215,11 +1215,16 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (!empty($this->socpeopleassigned)) {
|
||||
$already_inserted = array();
|
||||
foreach (array_keys($this->socpeopleassigned) as $id) {
|
||||
if (!empty($already_inserted[$val['id']])) continue;
|
||||
foreach (array_keys($this->socpeopleassigned) as $key => $val) {
|
||||
if (!is_array($val)) { // For backward compatibility when val=id
|
||||
$val = array('id' => $val);
|
||||
}
|
||||
if (!empty($already_inserted[$val['id']])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $id).", 0, 0, 0)";
|
||||
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $val['id']).", 0, 0, 0)";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
@@ -2352,6 +2357,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
// Load event
|
||||
$res = $this->fetch($actionCommReminder->fk_actioncomm);
|
||||
if ($res > 0) $res = $this->fetch_thirdparty();
|
||||
if ($res > 0) {
|
||||
// PREPARE EMAIL
|
||||
$errormesg = '';
|
||||
|
||||
@@ -1164,7 +1164,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -5116,116 +5116,119 @@ class Facture extends CommonInvoice
|
||||
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (!$error) {
|
||||
// Load event
|
||||
$res = $tmpinvoice->fetch($obj->id);
|
||||
// Create a loopError that is reset at each loop, this counter is added to the global counter at the end of loop
|
||||
$loopError = 0;
|
||||
|
||||
// Load event
|
||||
$res = $tmpinvoice->fetch($obj->id);
|
||||
if ($res > 0) {
|
||||
$tmpinvoice->fetch_thirdparty();
|
||||
|
||||
$outputlangs = new Translate('', $conf);
|
||||
if ($tmpinvoice->thirdparty->default_lang) {
|
||||
$outputlangs->setDefaultLang($tmpinvoice->thirdparty->default_lang);
|
||||
$outputlangs->loadLangs(array("main", "bills"));
|
||||
} else {
|
||||
$outputlangs = $langs;
|
||||
}
|
||||
|
||||
// Select email template
|
||||
$arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template));
|
||||
if (is_numeric($arraymessage) && $arraymessage <= 0) {
|
||||
$langs->load("errors");
|
||||
$this->output .= $langs->trans('ErrorFailedToFindEmailTemplate', $template);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// PREPARE EMAIL
|
||||
$errormesg = '';
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice);
|
||||
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice);
|
||||
|
||||
// Topic
|
||||
$sendTopic = make_substitutions(empty($arraymessage->topic) ? $outputlangs->transnoentitiesnoconv('InformationMessage') : $arraymessage->topic, $substitutionarray, $outputlangs, 1);
|
||||
|
||||
// Content
|
||||
$content = $outputlangs->transnoentitiesnoconv($arraymessage->content);
|
||||
|
||||
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
|
||||
|
||||
// Recipient
|
||||
$res = $tmpinvoice->fetch_thirdparty();
|
||||
$recipient = $tmpinvoice->thirdparty;
|
||||
if ($res > 0) {
|
||||
$tmpinvoice->fetch_thirdparty();
|
||||
|
||||
$outputlangs = new Translate('', $conf);
|
||||
if ($tmpinvoice->thirdparty->default_lang) {
|
||||
$outputlangs->setDefaultLang($tmpinvoice->thirdparty->default_lang);
|
||||
$outputlangs->loadLangs(array("main", "bills"));
|
||||
if (!empty($recipient->email)) {
|
||||
$to = $recipient->email;
|
||||
} else {
|
||||
$outputlangs = $langs;
|
||||
}
|
||||
|
||||
// Select email template
|
||||
$arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template));
|
||||
if (is_numeric($arraymessage) && $arraymessage <= 0) {
|
||||
$langs->load("errors");
|
||||
$this->output .= $langs->trans('ErrorFailedToFindEmailTemplate', $template);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// PREPARE EMAIL
|
||||
$errormesg = '';
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice);
|
||||
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice);
|
||||
|
||||
// Topic
|
||||
$sendTopic = make_substitutions(empty($arraymessage->topic) ? $outputlangs->transnoentitiesnoconv('InformationMessage') : $arraymessage->topic, $substitutionarray, $outputlangs, 1);
|
||||
|
||||
// Content
|
||||
$content = $outputlangs->transnoentitiesnoconv($arraymessage->content);
|
||||
|
||||
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
|
||||
|
||||
// Recipient
|
||||
$res = $tmpinvoice->fetch_thirdparty();
|
||||
$recipient = $tmpinvoice->thirdparty;
|
||||
if ($res > 0) {
|
||||
if (!empty($recipient->email)) {
|
||||
$to = $recipient->email;
|
||||
} else {
|
||||
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for user.";
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Sender
|
||||
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
if (empty($from)) {
|
||||
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// Errors Recipient
|
||||
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
|
||||
|
||||
$trackid = 'inv'.$tmpinvoice->id;
|
||||
|
||||
//join file is asked
|
||||
$joinFile = [];
|
||||
$joinFileName = [];
|
||||
$joinFileMime = [];
|
||||
if ($arraymessage->joinfiles == 1 && !empty($tmpinvoice->last_main_doc)) {
|
||||
$joinFile[] = DOL_DATA_ROOT.$tmpinvoice->last_main_doc;
|
||||
$joinFileName[] = basename($tmpinvoice->last_main_doc);
|
||||
$joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.$tmpinvoice->last_main_doc);
|
||||
}
|
||||
|
||||
// Mail Creation
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, '', "", 0, 1, $errors_to, '', $trackid, '', '', '');
|
||||
|
||||
// Sending Mail
|
||||
if ($cMailFile->sendfile()) {
|
||||
$nbMailSend++;
|
||||
} else {
|
||||
$errormesg = $cMailFile->error.' : '.$to;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($errormesg) {
|
||||
$errorsMsg[] = $errormesg;
|
||||
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for user.";
|
||||
$loopError++;
|
||||
}
|
||||
} else {
|
||||
$errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id;
|
||||
$error++;
|
||||
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
|
||||
$loopError++;
|
||||
}
|
||||
|
||||
// Sender
|
||||
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
if (empty($from)) {
|
||||
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
|
||||
$loopError++;
|
||||
}
|
||||
|
||||
if (!$loopError) {
|
||||
// Errors Recipient
|
||||
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
|
||||
|
||||
$trackid = 'inv'.$tmpinvoice->id;
|
||||
|
||||
//join file is asked
|
||||
$joinFile = [];
|
||||
$joinFileName = [];
|
||||
$joinFileMime = [];
|
||||
if ($arraymessage->joinfiles == 1 && !empty($tmpinvoice->last_main_doc)) {
|
||||
$joinFile[] = DOL_DATA_ROOT.$tmpinvoice->last_main_doc;
|
||||
$joinFileName[] = basename($tmpinvoice->last_main_doc);
|
||||
$joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.$tmpinvoice->last_main_doc);
|
||||
}
|
||||
|
||||
// Mail Creation
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, '', "", 0, 1, $errors_to, '', $trackid, '', '', '');
|
||||
|
||||
// Sending Mail
|
||||
if ($cMailFile->sendfile()) {
|
||||
$nbMailSend++;
|
||||
} else {
|
||||
$errormesg = $cMailFile->error.' : '.$to;
|
||||
$loopError++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($errormesg) {
|
||||
$errorsMsg[] = $errormesg;
|
||||
}
|
||||
} else {
|
||||
$errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id;
|
||||
$loopError++;
|
||||
}
|
||||
|
||||
$error += $loopError;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->output .= 'Nb of emails sent : '.$nbMailSend;
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
} else {
|
||||
if ($error > 0) { // If there is at least an error, early return with specific message
|
||||
$this->db->commit(); // We commit also on error, to have the error message recorded.
|
||||
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error;
|
||||
return $error;
|
||||
}
|
||||
|
||||
$this->output .= 'Nb of emails sent : '.$nbMailSend;
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
// Quantity
|
||||
print '<td class="right">';
|
||||
print $qty[$key];
|
||||
print price($qty[$key], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
|
||||
// Percent;
|
||||
|
||||
@@ -106,7 +106,7 @@ class box_actions extends ModeleBoxes
|
||||
$sql .= " AND s.rowid = ".((int) $user->socid);
|
||||
}
|
||||
if (empty($user->rights->agenda->allactions->read)) {
|
||||
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")";
|
||||
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id).")";
|
||||
}
|
||||
$sql .= " ORDER BY a.datec DESC";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
@@ -2060,7 +2060,9 @@ abstract class CommonObject
|
||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||
$sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
if (empty($user->admin) || !empty($user->entity) || $conf->entity != 1) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON ug.fk_user = te.rowid";
|
||||
}
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
@@ -2097,7 +2099,6 @@ abstract class CommonObject
|
||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql .= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql .= " AND ug.fk_user = te.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup').")";
|
||||
}
|
||||
} else {
|
||||
@@ -2130,7 +2131,9 @@ abstract class CommonObject
|
||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||
$sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
if (empty($user->admin) || !empty($user->entity) || $conf->entity != 1) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON ug.fk_user=te.rowid";
|
||||
}
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
@@ -2167,7 +2170,6 @@ abstract class CommonObject
|
||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql .= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql .= " AND ug.fk_user = te.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup').")";
|
||||
}
|
||||
} else {
|
||||
@@ -3892,8 +3894,12 @@ abstract class CommonObject
|
||||
$classpath = 'adherents/class';
|
||||
$module = 'adherent';
|
||||
} elseif ($objecttype == 'contact') {
|
||||
$module = 'societe';
|
||||
$module = 'societe';
|
||||
} elseif ($objecttype == 'action') {
|
||||
$module = 'agenda';
|
||||
$subelement = 'actionComm';
|
||||
}
|
||||
|
||||
// Set classfile
|
||||
$classfile = strtolower($subelement);
|
||||
$classname = ucfirst($subelement);
|
||||
@@ -8042,7 +8048,7 @@ abstract class CommonObject
|
||||
$("#"+child_list).hide();
|
||||
//Show mother lists
|
||||
} else if ($("#"+parent_list).val() != 0){
|
||||
$("#"+parent_list).show();
|
||||
showOptions'.$type.'(child_list, parent_list, orig_select[child_list]);
|
||||
}
|
||||
//Show the child list if the parent list value is selected
|
||||
$("select[name=\""+parent_list+"\"]").click(function() {
|
||||
|
||||
@@ -470,7 +470,7 @@ class Utils
|
||||
} elseif ($compression == 'zstd') {
|
||||
fclose($handle);
|
||||
}
|
||||
if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg)) { // No error
|
||||
if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg) || preg_match('/^\/\*M?!999999/', $errormsg)) { // Start of file is ok, NOT an error
|
||||
$errormsg = '';
|
||||
} else {
|
||||
// Renommer fichier sortie en fichier erreur
|
||||
|
||||
@@ -121,19 +121,17 @@ abstract class DoliDB implements Database
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize a string for SQL forging
|
||||
*
|
||||
* @param string $stringtosanitize String to escape
|
||||
* @param int $allowsimplequote 1=Allow simple quotes in string. When string is used as a list of SQL string ('aa', 'bb', ...)
|
||||
* @return string String escaped
|
||||
*/
|
||||
public function sanitize($stringtosanitize, $allowsimplequote = 0)
|
||||
* Sanitize a string for SQL forging
|
||||
*
|
||||
* @param string $stringtosanitize String to escape
|
||||
* @param int $allowsimplequote 1=Allow simple quotes in string. When string is used as a list of SQL string ('aa', 'bb', ...)
|
||||
* @param int $allowsequals 1=Allow equals sign
|
||||
* @param int $allowsspace 1=Allow space char
|
||||
* @return string String escaped
|
||||
*/
|
||||
public function sanitize($stringtosanitize, $allowsimplequote = 0, $allowsequals = 0, $allowsspace = 0)
|
||||
{
|
||||
if ($allowsimplequote) {
|
||||
return preg_replace('/[^a-z0-9_\-\.,\']/i', '', $stringtosanitize);
|
||||
} else {
|
||||
return preg_replace('/[^a-z0-9_\-\.,]/i', '', $stringtosanitize);
|
||||
}
|
||||
return preg_replace('/[^a-z0-9_\-\.,'.($allowsequals ? '=' : '').($allowsimplequote ? "\'" : '').($allowsspace ? ' ' : '').']/i', '', $stringtosanitize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1081,7 +1081,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
$publicmediasdirwithslash .= '/';
|
||||
}
|
||||
|
||||
if (strpos($upload_dir, $publicmediasdirwithslash) !== 0) { // We never add .noexe on files into media directory
|
||||
if (strpos($upload_dir, $publicmediasdirwithslash) !== 0 || !getDolGlobalInt("MAIN_DOCUMENT_DISABLE_NOEXE_IN_MEDIAS_DIR")) { // We never add .noexe on files into media directory
|
||||
$file_name .= '.noexe';
|
||||
$successcode = 2;
|
||||
}
|
||||
|
||||
@@ -9022,7 +9022,12 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
|
||||
|
||||
$value = preg_replace('/\s*\|\s*/', '|', $value);
|
||||
|
||||
$crits = explode(' ', $value);
|
||||
//natural mode search type 3 allow spaces into search ...
|
||||
if ($mode == 3 || $mode == -3) {
|
||||
$crits = explode(',', $value);
|
||||
} else {
|
||||
$crits = explode(' ', $value);
|
||||
}
|
||||
$res = '';
|
||||
if (!is_array($fields)) {
|
||||
$fields = array($fields);
|
||||
@@ -9072,7 +9077,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
|
||||
$listofcodes .= "'".$db->escape($val)."'";
|
||||
}
|
||||
}
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")";
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1, 0, 1).")";
|
||||
$i2++; // a criteria was added to string
|
||||
}
|
||||
if ($mode == -3) {
|
||||
|
||||
@@ -388,7 +388,7 @@ function show_stats_for_company($product, $socid)
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_propale['nb'];
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_propale['qty'];
|
||||
print price($product->stats_propale['qty'], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@@ -407,7 +407,7 @@ function show_stats_for_company($product, $socid)
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_proposal_supplier['nb'];
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_proposal_supplier['qty'];
|
||||
print price($product->stats_proposal_supplier['qty'], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@@ -426,7 +426,7 @@ function show_stats_for_company($product, $socid)
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande['nb'];
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande['qty'];
|
||||
print price($product->stats_commande['qty'], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@@ -445,7 +445,7 @@ function show_stats_for_company($product, $socid)
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande_fournisseur['nb'];
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande_fournisseur['qty'];
|
||||
print price($product->stats_commande_fournisseur['qty'], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@@ -464,7 +464,7 @@ function show_stats_for_company($product, $socid)
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture['nb'];
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture['qty'];
|
||||
print price($product->stats_facture['qty'], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@@ -483,7 +483,7 @@ function show_stats_for_company($product, $socid)
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture_fournisseur['nb'];
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture_fournisseur['qty'];
|
||||
print price($product->stats_facture_fournisseur['qty'], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@@ -503,7 +503,7 @@ function show_stats_for_company($product, $socid)
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_contrat['nb'];
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_contrat['qty'];
|
||||
print price($product->stats_contrat['qty'], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@@ -1333,6 +1333,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
// We set order into draft status
|
||||
$this->brouillon = 1;
|
||||
$this->statut = self::STATUS_DRAFT; // deprecated
|
||||
$this->status = self::STATUS_DRAFT;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (";
|
||||
$sql .= "ref";
|
||||
@@ -2145,6 +2147,16 @@ class CommandeFournisseur extends CommonOrder
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")";
|
||||
dol_syslog(__METHOD__." linked order lines", LOG_DEBUG);
|
||||
if (!$this->db->query($sql1)) {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =".((int) $this->id);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if (!$this->db->query($sql)) {
|
||||
@@ -3912,7 +3924,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql1 = 'UPDATE '.MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE rowid=".((int) $this->id);
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet=".((int) $this->id);
|
||||
$resql = $this->db->query($sql1);
|
||||
if (!$resql) {
|
||||
$this->db->rollback();
|
||||
|
||||
@@ -986,6 +986,13 @@ class Holiday extends CommonObject
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
|
||||
@@ -16,296 +16,290 @@ class SegmentException extends Exception
|
||||
*/
|
||||
class Segment implements IteratorAggregate, Countable
|
||||
{
|
||||
protected $xml;
|
||||
protected $xmlParsed = '';
|
||||
protected $name;
|
||||
protected $children = array();
|
||||
protected $vars = array();
|
||||
protected $xml;
|
||||
protected $xmlParsed = '';
|
||||
protected $name;
|
||||
protected $children = array();
|
||||
protected $vars = array();
|
||||
protected $images = array();
|
||||
protected $odf;
|
||||
protected $file;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $name name of the segment to construct
|
||||
* @param string $xml XML tree of the segment
|
||||
* @param string $odf odf
|
||||
*/
|
||||
public function __construct($name, $xml, $odf)
|
||||
{
|
||||
$this->name = (string) $name;
|
||||
$this->xml = (string) $xml;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $name name of the segment to construct
|
||||
* @param string $xml XML tree of the segment
|
||||
* @param string $odf odf
|
||||
*/
|
||||
public function __construct($name, $xml, $odf)
|
||||
{
|
||||
$this->name = (string) $name;
|
||||
$this->xml = (string) $xml;
|
||||
$this->odf = $odf;
|
||||
$zipHandler = $this->odf->getConfig('ZIP_PROXY');
|
||||
$this->file = new $zipHandler($this->odf->getConfig('PATH_TO_TMP'));
|
||||
$this->_analyseChildren($this->xml);
|
||||
}
|
||||
/**
|
||||
* Returns the name of the segment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
/**
|
||||
* Does the segment have children ?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasChildren()
|
||||
{
|
||||
return $this->getIterator()->hasChildren();
|
||||
}
|
||||
/**
|
||||
* Countable interface
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->children);
|
||||
}
|
||||
/**
|
||||
* IteratorAggregate interface
|
||||
*
|
||||
* @return Iterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new RecursiveIteratorIterator(new SegmentIterator($this->children), 1);
|
||||
}
|
||||
/**
|
||||
* Replace variables of the template in the XML code
|
||||
* All the children are also called
|
||||
* Complete the current segment with new line
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function merge()
|
||||
{
|
||||
// To provide debug information on line number processed
|
||||
global $count;
|
||||
if (empty($count)) $count=1;
|
||||
else $count++;
|
||||
$zipHandler = $this->odf->getConfig('ZIP_PROXY');
|
||||
$this->file = new $zipHandler($this->odf->getConfig('PATH_TO_TMP'));
|
||||
$this->_analyseChildren($this->xml);
|
||||
}
|
||||
/**
|
||||
* Returns the name of the segment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
/**
|
||||
* Does the segment have children ?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasChildren()
|
||||
{
|
||||
return $this->getIterator()->hasChildren();
|
||||
}
|
||||
/**
|
||||
* Countable interface
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->children);
|
||||
}
|
||||
/**
|
||||
* IteratorAggregate interface
|
||||
*
|
||||
* @return Iterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new RecursiveIteratorIterator(new SegmentIterator($this->children), 1);
|
||||
}
|
||||
/**
|
||||
* Replace variables of the template in the XML code
|
||||
* All the children are also called
|
||||
* Complete the current segment with new line
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function merge()
|
||||
{
|
||||
// To provide debug information on line number processed
|
||||
global $count;
|
||||
if (empty($count)) $count=1;
|
||||
else $count++;
|
||||
|
||||
if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps
|
||||
$this->xml = $this->savxml;
|
||||
$tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values
|
||||
if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps
|
||||
$this->xml = $this->savxml;
|
||||
$tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values
|
||||
|
||||
// Search all tags fou into condition to complete $tmpvars, so we will proceed all tests even if not defined
|
||||
$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
|
||||
preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER);
|
||||
//var_dump($tmpvars);exit;
|
||||
foreach($matches as $match) // For each match, if there is no entry into this->vars, we add it
|
||||
{
|
||||
if (! empty($match[1]) && ! isset($tmpvars[$match[1]]))
|
||||
{
|
||||
$tmpvars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop
|
||||
}
|
||||
}
|
||||
// Search all tags fou into condition to complete $tmpvars, so we will proceed all tests even if not defined
|
||||
$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
|
||||
preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER);
|
||||
//var_dump($tmpvars);exit;
|
||||
foreach ($matches as $match) { // For each match, if there is no entry into this->vars, we add it
|
||||
if (! empty($match[1]) && ! isset($tmpvars[$match[1]])) {
|
||||
$tmpvars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop
|
||||
}
|
||||
}
|
||||
|
||||
// Conditionals substitution
|
||||
// Note: must be done before static substitution, else the variable will be replaced by its value and the conditional won't work anymore
|
||||
foreach($tmpvars as $key => $value)
|
||||
{
|
||||
// If value is true (not 0 nor false nor null nor empty string)
|
||||
if ($value)
|
||||
{
|
||||
// Remove the IF tag
|
||||
$this->xml = str_replace('[!-- IF '.$key.' --]', '', $this->xml);
|
||||
// Remove everything between the ELSE tag (if it exists) and the ENDIF tag
|
||||
$reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
$this->xml = preg_replace($reg, '', $this->xml);
|
||||
}
|
||||
// Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it
|
||||
else
|
||||
{
|
||||
// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
|
||||
$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
|
||||
if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml);
|
||||
}
|
||||
// Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether)
|
||||
$this->xml = preg_replace($reg, '', $this->xml);
|
||||
}
|
||||
}
|
||||
// Conditionals substitution
|
||||
// Note: must be done before static substitution, else the variable will be replaced by its value and the conditional won't work anymore
|
||||
foreach ($tmpvars as $key => $value) {
|
||||
// If value is true (not 0 nor false nor null nor empty string)
|
||||
if ($value) {
|
||||
// Remove the IF tag
|
||||
$this->xml = str_replace('[!-- IF '.$key.' --]', '', $this->xml);
|
||||
// Remove everything between the ELSE tag (if it exists) and the ENDIF tag
|
||||
$reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
$this->xml = preg_replace($reg, '', $this->xml);
|
||||
}
|
||||
// Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it
|
||||
else {
|
||||
// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
|
||||
$reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
|
||||
if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml);
|
||||
}
|
||||
// Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether)
|
||||
$this->xml = preg_replace($reg, '', $this->xml);
|
||||
}
|
||||
}
|
||||
|
||||
$this->xmlParsed .= str_replace(array_keys($tmpvars), array_values($tmpvars), $this->xml);
|
||||
if ($this->hasChildren()) {
|
||||
foreach ($this->children as $child) {
|
||||
$this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed);
|
||||
$child->xmlParsed = '';
|
||||
}
|
||||
}
|
||||
$reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/sm";
|
||||
$this->xmlParsed = preg_replace($reg, '$1', $this->xmlParsed);
|
||||
$this->xmlParsed .= str_replace(array_keys($tmpvars), array_values($tmpvars), $this->xml);
|
||||
if ($this->hasChildren()) {
|
||||
foreach ($this->children as $child) {
|
||||
$this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed);
|
||||
$child->xmlParsed = '';
|
||||
}
|
||||
}
|
||||
$reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/sm";
|
||||
$this->xmlParsed = preg_replace($reg, '$1', $this->xmlParsed);
|
||||
// Miguel Erill 09704/2017 - Add macro replacement to invoice lines
|
||||
$this->xmlParsed = $this->macroReplace($this->xmlParsed);
|
||||
$this->file->open($this->odf->getTmpfile());
|
||||
foreach ($this->images as $imageKey => $imageValue) {
|
||||
$this->xmlParsed = $this->macroReplace($this->xmlParsed);
|
||||
$this->file->open($this->odf->getTmpfile());
|
||||
foreach ($this->images as $imageKey => $imageValue) {
|
||||
if ($this->file->getFromName('Pictures/' . $imageValue) === false) {
|
||||
// Add the image inside the ODT document
|
||||
$this->file->addFile($imageKey, 'Pictures/' . $imageValue);
|
||||
// Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice)
|
||||
$this->odf->addImageToManifest($imageValue);
|
||||
}
|
||||
}
|
||||
$this->file->close();
|
||||
}
|
||||
$this->file->close();
|
||||
|
||||
return $this->xmlParsed;
|
||||
}
|
||||
return $this->xmlParsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to replace macros for invoice short and long month, invoice year
|
||||
*
|
||||
* Substitution occur when the invoice is generated, not considering the invoice date
|
||||
* so do not (re)generate in a diferent date than the one that the invoice belongs to
|
||||
* Perhaps it would be better to use the invoice issued date but I still do not know
|
||||
* how to get it here
|
||||
*
|
||||
* Miguel Erill 09/04/2017
|
||||
*
|
||||
* @param string $value String to convert
|
||||
*/
|
||||
public function macroReplace($text)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
global $langs;
|
||||
/**
|
||||
* Function to replace macros for invoice short and long month, invoice year
|
||||
*
|
||||
* Substitution occur when the invoice is generated, not considering the invoice date
|
||||
* so do not (re)generate in a diferent date than the one that the invoice belongs to
|
||||
* Perhaps it would be better to use the invoice issued date but I still do not know
|
||||
* how to get it here
|
||||
*
|
||||
* Miguel Erill 09/04/2017
|
||||
*
|
||||
* @param string $value String to convert
|
||||
*/
|
||||
public function macroReplace($text)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
global $langs;
|
||||
|
||||
$hoy = dol_getdate(dol_now('tzuser'));
|
||||
$dateinonemontharray = dol_get_next_month($hoy['mon'], $hoy['year']);
|
||||
$nextMonth = $dateinonemontharray['month'];
|
||||
$hoy = dol_getdate(dol_now('tzuser'));
|
||||
$dateinonemontharray = dol_get_next_month($hoy['mon'], $hoy['year']);
|
||||
$nextMonth = $dateinonemontharray['month'];
|
||||
|
||||
$patterns=array( '/__CURRENTDAY__/u','/__CURENTWEEKDAY__/u',
|
||||
'/__CURRENTMONTH__/u','/__CURRENTMONTHLONG__/u',
|
||||
'/__NEXTMONTH__/u','/__NEXTMONTHLONG__/u',
|
||||
'/__CURRENTYEAR__/u','/__NEXTYEAR__/u' );
|
||||
$values=array( $hoy['mday'], $langs->transnoentitiesnoconv($hoy['weekday']),
|
||||
$hoy['mon'], $langs->transnoentitiesnoconv($hoy['month']),
|
||||
$nextMonth, monthArray($langs)[$nextMonth],
|
||||
$hoy['year'], $hoy['year']+1 );
|
||||
$patterns=array( '/__CURRENTDAY__/u','/__CURENTWEEKDAY__/u',
|
||||
'/__CURRENTMONTH__/u','/__CURRENTMONTHLONG__/u',
|
||||
'/__NEXTMONTH__/u','/__NEXTMONTHLONG__/u',
|
||||
'/__CURRENTYEAR__/u','/__NEXTYEAR__/u' );
|
||||
$values=array( $hoy['mday'], $langs->transnoentitiesnoconv($hoy['weekday']),
|
||||
$hoy['mon'], $langs->transnoentitiesnoconv($hoy['month']),
|
||||
$nextMonth, monthArray($langs)[$nextMonth],
|
||||
$hoy['year'], $hoy['year']+1 );
|
||||
|
||||
$text=preg_replace($patterns, $values, $text);
|
||||
$text=preg_replace($patterns, $values, $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyse the XML code in order to find children
|
||||
*
|
||||
* @param string $xml Xml
|
||||
* @return Segment
|
||||
*/
|
||||
protected function _analyseChildren($xml)
|
||||
{
|
||||
// $reg2 = "#\[!--\sBEGIN\s([\S]*)\s--\](?:<\/text:p>)?(.*)(?:<text:p\s.*>)?\[!--\sEND\s(\\1)\s--\]#sm";
|
||||
$reg2 = "#\[!--\sBEGIN\s([\S]*)\s--\](.*)\[!--\sEND\s(\\1)\s--\]#sm";
|
||||
preg_match_all($reg2, $xml, $matches);
|
||||
for ($i = 0, $size = count($matches[0]); $i < $size; $i++) {
|
||||
if ($matches[1][$i] != $this->name) {
|
||||
$this->children[$matches[1][$i]] = new self($matches[1][$i], $matches[0][$i], $this->odf);
|
||||
} else {
|
||||
$this->_analyseChildren($matches[2][$i]);
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Analyse the XML code in order to find children
|
||||
*
|
||||
* @param string $xml Xml
|
||||
* @return Segment
|
||||
*/
|
||||
protected function _analyseChildren($xml)
|
||||
{
|
||||
// $reg2 = "#\[!--\sBEGIN\s([\S]*)\s--\](?:<\/text:p>)?(.*)(?:<text:p\s.*>)?\[!--\sEND\s(\\1)\s--\]#sm";
|
||||
$reg2 = "#\[!--\sBEGIN\s([\S]*)\s--\](.*)\[!--\sEND\s(\\1)\s--\]#sm";
|
||||
preg_match_all($reg2, $xml, $matches);
|
||||
for ($i = 0, $size = count($matches[0]); $i < $size; $i++) {
|
||||
if ($matches[1][$i] != $this->name) {
|
||||
$this->children[$matches[1][$i]] = new self($matches[1][$i], $matches[0][$i], $this->odf);
|
||||
} else {
|
||||
$this->_analyseChildren($matches[2][$i]);
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a template variable to replace
|
||||
*
|
||||
* @param string $key Key
|
||||
* @param string $value Value
|
||||
* @param string $encode Encode
|
||||
* @param string $charset Charset
|
||||
* @throws SegmentException
|
||||
* @return Segment
|
||||
*/
|
||||
public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
|
||||
{
|
||||
if (strpos($this->xml, $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')) === false) {
|
||||
//throw new SegmentException("var $key not found in {$this->getName()}");
|
||||
}
|
||||
/**
|
||||
* Assign a template variable to replace
|
||||
*
|
||||
* @param string $key Key
|
||||
* @param string $value Value
|
||||
* @param string $encode Encode
|
||||
* @param string $charset Charset
|
||||
* @throws SegmentException
|
||||
* @return Segment
|
||||
*/
|
||||
public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
|
||||
{
|
||||
if (strpos($this->xml, $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')) === false) {
|
||||
//throw new SegmentException("var $key not found in {$this->getName()}");
|
||||
}
|
||||
|
||||
$tag = $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT');
|
||||
$tag = $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT');
|
||||
|
||||
$this->vars[$tag] = $this->odf->convertVarToOdf($value, $encode, $charset);
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Assign a template variable as a picture
|
||||
*
|
||||
* @param string $key name of the variable within the template
|
||||
* @param string $value path to the picture
|
||||
* @throws OdfException
|
||||
* @return Segment
|
||||
*/
|
||||
public function setImage($key, $value)
|
||||
{
|
||||
$filename = strtok(strrchr($value, '/'), '/.');
|
||||
$file = substr(strrchr($value, '/'), 1);
|
||||
$size = @getimagesize($value);
|
||||
if ($size === false) {
|
||||
throw new OdfException("Invalid image");
|
||||
}
|
||||
// Set the width and height of the page
|
||||
list ($width, $height) = $size;
|
||||
$width *= Odf::PIXEL_TO_CM;
|
||||
$height *= Odf::PIXEL_TO_CM;
|
||||
// Fix local-aware issues (eg: 12,10 -> 12.10)
|
||||
$width = sprintf("%F", $width);
|
||||
$height = sprintf("%F", $height);
|
||||
|
||||
$xml = <<<IMG
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Assign a template variable as a picture
|
||||
*
|
||||
* @param string $key name of the variable within the template
|
||||
* @param string $value path to the picture
|
||||
* @throws OdfException
|
||||
* @return Segment
|
||||
*/
|
||||
public function setImage($key, $value)
|
||||
{
|
||||
$filename = strtok(strrchr($value, '/'), '/.');
|
||||
$file = substr(strrchr($value, '/'), 1);
|
||||
$size = @getimagesize($value);
|
||||
if ($size === false) {
|
||||
throw new OdfException("Invalid image");
|
||||
}
|
||||
// Set the width and height of the page
|
||||
list ($width, $height) = $size;
|
||||
$width *= Odf::PIXEL_TO_CM;
|
||||
$height *= Odf::PIXEL_TO_CM;
|
||||
// Fix local-aware issues (eg: 12,10 -> 12.10)
|
||||
$width = sprintf("%F", $width);
|
||||
$height = sprintf("%F", $height);
|
||||
|
||||
$xml = <<<IMG
|
||||
<draw:frame draw:style-name="fr1" draw:name="$filename" text:anchor-type="aschar" svg:width="{$width}cm" svg:height="{$height}cm" draw:z-index="3"><draw:image xlink:href="Pictures/$file" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>
|
||||
IMG;
|
||||
$this->images[$value] = $file;
|
||||
$this->setVars($key, $xml, false);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Shortcut to retrieve a child
|
||||
*
|
||||
* @param string $prop Prop
|
||||
* @return Segment
|
||||
* @throws SegmentException
|
||||
*/
|
||||
public function __get($prop)
|
||||
{
|
||||
if (array_key_exists($prop, $this->children)) {
|
||||
return $this->children[$prop];
|
||||
} else {
|
||||
throw new SegmentException('child ' . $prop . ' does not exist');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Proxy for setVars
|
||||
*
|
||||
* @param string $meth Meth
|
||||
* @param array $args Args
|
||||
* @return Segment
|
||||
*/
|
||||
public function __call($meth, $args)
|
||||
{
|
||||
try {
|
||||
return $this->setVars($meth, $args[0]);
|
||||
} catch (SegmentException $e) {
|
||||
throw new SegmentException("method $meth nor var $meth exist");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the parsed XML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getXmlParsed()
|
||||
{
|
||||
return $this->xmlParsed;
|
||||
}
|
||||
$this->images[$value] = $file;
|
||||
$this->setVars($key, $xml, false);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Shortcut to retrieve a child
|
||||
*
|
||||
* @param string $prop Prop
|
||||
* @return Segment
|
||||
* @throws SegmentException
|
||||
*/
|
||||
public function __get($prop)
|
||||
{
|
||||
if (array_key_exists($prop, $this->children)) {
|
||||
return $this->children[$prop];
|
||||
} else {
|
||||
throw new SegmentException('child ' . $prop . ' does not exist');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Proxy for setVars
|
||||
*
|
||||
* @param string $meth Meth
|
||||
* @param array $args Args
|
||||
* @return Segment
|
||||
*/
|
||||
public function __call($meth, $args)
|
||||
{
|
||||
try {
|
||||
return $this->setVars($meth, $args[0]);
|
||||
} catch (SegmentException $e) {
|
||||
throw new SegmentException("method $meth nor var $meth exist");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the parsed XML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getXmlParsed()
|
||||
{
|
||||
return $this->xmlParsed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -522,7 +522,7 @@ IMG;
|
||||
private function _parse($type = 'content')
|
||||
{
|
||||
// Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined
|
||||
$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
|
||||
$reg='@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
|
||||
$matches = array();
|
||||
preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER);
|
||||
|
||||
@@ -544,7 +544,7 @@ IMG;
|
||||
// Remove the IF tag
|
||||
$this->contentXml = str_replace('[!-- IF '.$key.' --]', '', $this->contentXml);
|
||||
// Remove everything between the ELSE tag (if it exists) and the ENDIF tag
|
||||
$reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
$reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
$this->contentXml = preg_replace($reg, '', $this->contentXml);
|
||||
/*if ($sav != $this->contentXml)
|
||||
{
|
||||
@@ -557,7 +557,7 @@ IMG;
|
||||
//dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF ");
|
||||
//$sav=$this->contentXml;
|
||||
// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
|
||||
$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
$reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
|
||||
if (!empty($match[3])) $this->contentXml = str_replace($match[0], $match[3], $this->contentXml);
|
||||
|
||||
@@ -332,6 +332,8 @@ ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN desiredstock float;
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN fk_state integer DEFAULT NULL AFTER fk_country;
|
||||
|
||||
ALTER TABLE llx_product CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
|
||||
ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255);
|
||||
ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255);
|
||||
ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255);
|
||||
@@ -597,3 +599,172 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position)
|
||||
|
||||
ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64);
|
||||
|
||||
|
||||
-- ALL tms thanks to regis (commit 111f73bd863c7120a9c13a8fc9ae227a02079cb0)
|
||||
|
||||
ALTER TABLE llx_accounting_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_accounting_bookkeeping CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_accounting_fiscalyear CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_actioncomm_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_actioncomm CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_adherent_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_adherent CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_adherent_type_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_adherent_type CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_advtargetemailing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_asset_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_asset CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_asset_type_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_asset_type CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bank_account_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bank_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bank CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_blockedlog_authority CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_blockedlog CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bom_bom_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bom_bomline_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bom_bom CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bordereau_cheque CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_boxes_def CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_budget_lines CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_budget CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_categories_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_categorie CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_c_email_senderprofile CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_c_email_templates CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_c_field_list CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_chargesociales CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commandedet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseurdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur_log CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_comment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_const CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contratdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contratdet_log CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contratdet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contrat_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contrat CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_cronjob CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_c_shipment_mode CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_deplacement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_don_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_don CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_element_resources CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_emailcollector_emailcollectoraction CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_emailcollector_emailcollectorfilter CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_emailcollector_emailcollector CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_entrepot_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_entrepot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_establishment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_events CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expeditiondet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expedition_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expedition CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expensereport_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expensereport_ik CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expensereport_rules CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expensereport CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facturedet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facturedet_rec_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_fourn_det_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_fourn_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_fourn CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_rec_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_rec CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_fichinterdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_fichinter_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_fichinter CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_holiday_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_holiday CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_inventorydet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_inventorydet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_inventory CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_inventory CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_loan_schedule CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_loan CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_localtax CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mailing_cibles CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mailing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mailing_unsubscribe CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_menu CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mrp_mo_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mrp_mo CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mrp_production CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_notify_def CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_notify CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_online_signatures CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_opensurvey_comments CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_opensurvey_user_studs CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_paiementcharge CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_paiementfourn CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_paiement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_donation CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_expensereport CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_loan CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_salary_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_salary CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_various CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_pos_cash_fence CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_printing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_batch CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_customer_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_fournisseur_price_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_fournisseur_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_lot_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_lot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_price_by_qty CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_stock_entrepot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_stock CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_projet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_projet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_projet_task_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_projet_task CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_propaldet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_propal_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_propal_merge_pdf_product CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_propal CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_reception_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_reception CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_resource_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_resource CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_address CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_contacts CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_prices CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_remise CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_remise_supplier CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_rib CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_socpeople_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_socpeople CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_stock_mouvement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_subscription CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_supplier_proposaldet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_supplier_proposal_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_supplier_proposal CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_ticket_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_ticket CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_tva CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_user_employment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_user_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_usergroup_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_usergroup CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_user_rib CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_user CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_website_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_website_page CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_website CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_zapier_hook CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
|
||||
@@ -195,9 +195,19 @@ if ($action == 'order' && GETPOST('valid')) {
|
||||
}
|
||||
|
||||
$line->tva_tx = $productsupplier->vatrate_supplier;
|
||||
$tva = $line->tva_tx / 100;
|
||||
|
||||
// If we use multicurrency
|
||||
if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) {
|
||||
$line->multicurrency_code = $productsupplier->fourn_multicurrency_code;
|
||||
$line->fk_multicurrency = $productsupplier->fourn_multicurrency_id;
|
||||
$line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice;
|
||||
$line->multicurrency_total_ht = $line->multicurrency_subprice * $qty;
|
||||
$line->multicurrency_total_tva = $line->multicurrency_total_ht * $tva;
|
||||
$line->multicurrency_total_ttc = $line->multicurrency_total_ht + $line->multicurrency_total_tva;
|
||||
}
|
||||
$line->subprice = $productsupplier->fourn_pu;
|
||||
$line->total_ht = $productsupplier->fourn_pu * $qty;
|
||||
$tva = $line->tva_tx / 100;
|
||||
$line->total_tva = $line->total_ht * $tva;
|
||||
$line->total_ttc = $line->total_ht + $line->total_tva;
|
||||
$line->remise_percent = $productsupplier->remise_percent;
|
||||
@@ -262,7 +272,8 @@ if ($action == 'order' && GETPOST('valid')) {
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
$line->fk_unit
|
||||
$line->fk_unit,
|
||||
$line->multicurrency_subprice ?? 0
|
||||
);
|
||||
}
|
||||
if ($result < 0) {
|
||||
@@ -277,6 +288,7 @@ if ($action == 'order' && GETPOST('valid')) {
|
||||
} else {
|
||||
$order->socid = $suppliersid[$i];
|
||||
$order->fetch_thirdparty();
|
||||
$order->multicurrency_code = $order->thirdparty->multicurrency_code;
|
||||
|
||||
// Trick to know which orders have been generated using the replenishment feature
|
||||
$order->source = $order::SOURCE_ID_REPLENISHMENT;
|
||||
|
||||
@@ -215,7 +215,7 @@ if (is_array($object->lines) && (count($object->lines) > 0)) {
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
$user->getrights();
|
||||
$user->getrights('', 1); // We force rights reload to have the correct permissions for user in the entity we just switched in
|
||||
}
|
||||
|
||||
// Reload langs
|
||||
|
||||
Reference in New Issue
Block a user