mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 09:08:09 +01:00
Compare commits
46 Commits
22.0.3
...
aa8fac1deb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa8fac1deb | ||
|
|
2ebdcfda5c | ||
|
|
70431043af | ||
|
|
ad37ece7bc | ||
|
|
0e1c580f11 | ||
|
|
4223ff08ce | ||
|
|
d16f8b68db | ||
|
|
d8891130f5 | ||
|
|
b2f9de7489 | ||
|
|
1002557746 | ||
|
|
908880c82c | ||
|
|
3608e9b102 | ||
|
|
c1c2358e75 | ||
|
|
1e16bf5160 | ||
|
|
c2635f5242 | ||
|
|
b1a4520059 | ||
|
|
2935a245a3 | ||
|
|
5589ed71b2 | ||
|
|
32f160355b | ||
|
|
5a61cc9393 | ||
|
|
7ed0af2a13 | ||
|
|
1cd3ca3222 | ||
|
|
c8acd48e34 | ||
|
|
9e8460c3dc | ||
|
|
70f5e20572 | ||
|
|
f32386208d | ||
|
|
1adf4ce67f | ||
|
|
ac4820b4cb | ||
|
|
f9d285c416 | ||
|
|
f1f7ea93b0 | ||
|
|
1f6cec841f | ||
|
|
4dcbd826e6 | ||
|
|
fd5c9b0562 | ||
|
|
21843e68b0 | ||
|
|
30ecf80732 | ||
|
|
9de04b1c48 | ||
|
|
7e7939d234 | ||
|
|
3ad30f8622 | ||
|
|
3b7cda03f3 | ||
|
|
223326610e | ||
|
|
38980a935c | ||
|
|
66d72d0bba | ||
|
|
403dad1660 | ||
|
|
12d078c651 | ||
|
|
0dbbd453e5 | ||
|
|
8ddf9f6075 |
22
.github/workflows/ci-on-release.yml
vendored
Normal file
22
.github/workflows/ci-on-release.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: "CI-RELEASE"
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
trigger-docker:
|
||||
steps:
|
||||
- name: Generate a token
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@v2
|
||||
with:
|
||||
app-id: ${{ vars.RELEASE_DOCKER_ID }}
|
||||
private-key: ${{ secrets.RELEASE_DOCKER_SECRET }}
|
||||
|
||||
- uses: peter-evans/repository-dispatch@v4
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
repository: Dolibarr/dolibarr-docker
|
||||
event-type: new-release
|
||||
client-payload: '{"version": "${{ github.event.release.tag_name }}"}'
|
||||
29
.github/workflows/pr-18.yaml
vendored
29
.github/workflows/pr-18.yaml
vendored
@@ -16,11 +16,10 @@ on:
|
||||
branches:
|
||||
- "18.0"
|
||||
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
|
||||
jobs:
|
||||
assign-and-label-v18:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -47,18 +46,26 @@ jobs:
|
||||
echo "env.url=${{env.url}}"
|
||||
gh pr edit "${{env.url}}" --add-label "Issue for v18 maintenance Team"
|
||||
|
||||
- name: Assign reviewer 1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
url: ${{ github.event.pull_request.html_url }}
|
||||
- name: Set reviewers except PR author
|
||||
id: set-reviewers
|
||||
run: |
|
||||
echo "env.url=${{env.url}}"
|
||||
gh pr edit "${{env.url}}" --add-reviewer lvessiller-opendsi
|
||||
# Liste des reviewers à ajuster selon équipe
|
||||
REVIEWERS=("lvessiller-opendsi" "rycks")
|
||||
AUTHOR="${{ github.event.pull_request.user.login }}"
|
||||
FINAL_REVIEWERS=()
|
||||
for reviewer in "${REVIEWERS[@]}"; do
|
||||
if [ "$reviewer" != "$AUTHOR" ]; then
|
||||
FINAL_REVIEWERS+=("$reviewer")
|
||||
fi
|
||||
done
|
||||
echo "reviewers=$(IFS=, ; echo "${FINAL_REVIEWERS[*]}")" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Assign reviewer 2
|
||||
- name: Assign reviewers
|
||||
if: steps.set-reviewers.outputs.reviewers != ''
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
url: ${{ github.event.pull_request.html_url }}
|
||||
reviewers: ${{ steps.set-reviewers.outputs.reviewers }}
|
||||
run: |
|
||||
echo "env.url=${{env.url}}"
|
||||
gh pr edit "${{env.url}}" --add-reviewer rycks
|
||||
echo "Assigning reviewers: ${{env.reviewers}}"
|
||||
gh pr edit "${{env.url}}" --add-reviewer "${{env.reviewers}}"
|
||||
|
||||
@@ -192,7 +192,6 @@ class Propal extends CommonObject
|
||||
public $fin_validite;
|
||||
|
||||
public $user_author_id;
|
||||
public $user_valid_id;
|
||||
public $user_close_id;
|
||||
|
||||
/**
|
||||
@@ -1487,7 +1486,9 @@ class Propal extends CommonObject
|
||||
|
||||
// Clear fields
|
||||
$object->user_author = $user->id;
|
||||
$object->user_valid = 0;
|
||||
|
||||
$object->user_validation_id = 0;
|
||||
|
||||
$object->date = $now;
|
||||
$object->datep = $now; // deprecated
|
||||
$object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600);
|
||||
@@ -1682,7 +1683,7 @@ class Propal extends CommonObject
|
||||
$this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array();
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid_id = $obj->fk_user_valid;
|
||||
$this->user_validation_id = $obj->fk_user_valid;
|
||||
$this->user_close_id = $obj->fk_user_cloture;
|
||||
|
||||
//Incoterms
|
||||
@@ -1784,7 +1785,7 @@ class Propal extends CommonObject
|
||||
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
|
||||
$sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").",";
|
||||
$sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").",";
|
||||
$sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").",";
|
||||
$sql .= " fk_user_valid = ".(!empty($this->user_validation_id) ? (int) $this->user_validation_id : "null").",";
|
||||
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
|
||||
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
|
||||
$sql .= " deposit_percent=".(!empty($this->deposit_percent) ? "'".$this->db->escape($this->deposit_percent)."'" : "null").",";
|
||||
@@ -2083,7 +2084,7 @@ class Propal extends CommonObject
|
||||
$this->ref = $num;
|
||||
$this->brouillon = 0;
|
||||
$this->statut = self::STATUS_VALIDATED;
|
||||
$this->user_valid_id = $user->id;
|
||||
$this->user_validation_id = $user->id;
|
||||
$this->datev = $now;
|
||||
|
||||
$this->db->commit();
|
||||
@@ -3369,9 +3370,7 @@ class Propal extends CommonObject
|
||||
$this->user_creation = $cuser;
|
||||
|
||||
if ($obj->fk_user_valid) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
$this->user_validation_id = $obj->fk_user_valid;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_signature) {
|
||||
|
||||
@@ -1710,25 +1710,25 @@ if (empty($reshook)) {
|
||||
|
||||
// Date start
|
||||
$date_start = false;
|
||||
if ($lines[$i]->date_debut_prevue) {
|
||||
if (isset($lines[$i]->date_debut_prevue)) {
|
||||
$date_start = $lines[$i]->date_debut_prevue;
|
||||
}
|
||||
if ($lines[$i]->date_debut_reel) {
|
||||
if (isset($lines[$i]->date_debut_reel)) {
|
||||
$date_start = $lines[$i]->date_debut_reel;
|
||||
}
|
||||
if ($lines[$i]->date_start) {
|
||||
if (isset($lines[$i]->date_start)) {
|
||||
$date_start = $lines[$i]->date_start;
|
||||
}
|
||||
|
||||
// Date end
|
||||
$date_end = false;
|
||||
if ($lines[$i]->date_fin_prevue) {
|
||||
if (isset($lines[$i]->date_fin_prevue)) {
|
||||
$date_end = $lines[$i]->date_fin_prevue;
|
||||
}
|
||||
if ($lines[$i]->date_fin_reel) {
|
||||
if (isset($lines[$i]->date_fin_reel)) {
|
||||
$date_end = $lines[$i]->date_fin_reel;
|
||||
}
|
||||
if ($lines[$i]->date_end) {
|
||||
if (isset($lines[$i]->date_end)) {
|
||||
$date_end = $lines[$i]->date_end;
|
||||
}
|
||||
|
||||
@@ -5128,9 +5128,9 @@ if ($action == 'create') {
|
||||
$total_next_ht = $total_next_ttc = 0;
|
||||
|
||||
foreach ($object->tab_next_situation_invoice as $next_invoice) {
|
||||
$totalpaid = $next_invoice->getSommePaiement(0);
|
||||
$totalcreditnotes = $next_invoice->getSumCreditNotesUsed(0);
|
||||
$totaldeposits = $next_invoice->getSumDepositsUsed(0);
|
||||
$next_invoice_total_paid = $next_invoice->getSommePaiement(0);
|
||||
$next_invoice_totalcreditnotes = $next_invoice->getSumCreditNotesUsed(0);
|
||||
$next_invoice_totaldeposits = $next_invoice->getSumDepositsUsed(0);
|
||||
$total_next_ht += $next_invoice->total_ht;
|
||||
$total_next_ttc += $next_invoice->total_ttc;
|
||||
|
||||
@@ -5143,7 +5143,7 @@ if ($action == 'create') {
|
||||
}
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaid + $totalcreditnotes + $totaldeposits).'</td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $next_invoice_total_paid + $next_invoice_totalcreditnotes + $next_invoice_totaldeposits).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@@ -5796,10 +5796,9 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
|
||||
// For situation invoice with excess received
|
||||
// For situation invoice
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
&& ($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits) > 0
|
||||
&& $usercancreate
|
||||
&& !$objectidnext
|
||||
&& $object->is_last_in_cycle()
|
||||
|
||||
@@ -351,9 +351,11 @@ if (preg_match('/^set(\w+)$/', $action, $reg) && GETPOST('id', 'int') > 0 && !em
|
||||
if ($action == "update_extras" && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
|
||||
$object->fetch(GETPOST('id', 'int'));
|
||||
|
||||
$attribute = GETPOST('attribute', 'aZ09');
|
||||
|
||||
$error = 0;
|
||||
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, $attribute);
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
setEventMessages($extrafields->error, $object->errors, 'errors');
|
||||
|
||||
@@ -60,8 +60,15 @@ $module = $object->module;
|
||||
$element = $object->element;
|
||||
|
||||
$usesublevelpermission = ($module != $element ? $element : '');
|
||||
if ($usesublevelpermission && !isset($user->rights->$module->$element)) { // There is no permission on object defined, we will check permission on module directly
|
||||
$usesublevelpermission = '';
|
||||
$exclude = array('projet_task', 'project_task'); // for user rights compatibility
|
||||
if ($usesublevelpermission) {
|
||||
if (!in_array($usesublevelpermission, $exclude)) {
|
||||
if (!isset($user->rights->$module->$element)) { // There is no permission on object defined, we will check permission on module directly
|
||||
$usesublevelpermission = '';
|
||||
}
|
||||
} elseif (!isset($user->rights->$module)) {
|
||||
$usesublevelpermission = '';
|
||||
}
|
||||
}
|
||||
|
||||
//print $object->id.' - '.$object->module.' - '.$object->element.' - '.$object->table_element.' - '.$usesublevelpermission."\n";
|
||||
|
||||
@@ -631,7 +631,6 @@ abstract class CommonObject
|
||||
*/
|
||||
public $fk_user_modif;
|
||||
|
||||
|
||||
public $next_prev_filter;
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,6 +80,10 @@ class FormSetup
|
||||
*/
|
||||
public $formHiddenInputs = array();
|
||||
|
||||
/**
|
||||
* @var string[] $errors
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -253,10 +257,9 @@ class FormSetup
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$this->setErrors($hookmanager->errors);
|
||||
$this->errors = $hookmanager->errors;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($reshook > 0) {
|
||||
return $reshook;
|
||||
}
|
||||
|
||||
@@ -12996,8 +12996,8 @@ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto')
|
||||
{
|
||||
if ($hourTime === 'getpost') {
|
||||
$hour = GETPOSTINT($prefix . 'hour');
|
||||
$minute = GETPOSTINT($prefix . 'minute');
|
||||
$second = GETPOSTINT($prefix . 'second');
|
||||
$minute = GETPOSTINT($prefix . 'min');
|
||||
$second = GETPOSTINT($prefix . 'sec');
|
||||
} elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) {
|
||||
$hour = intval($m[1]);
|
||||
$minute = intval($m[2]);
|
||||
@@ -13034,8 +13034,8 @@ function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto'
|
||||
if ($hourTime === 'getpost' || ($timestamp !== null && dol_print_date($timestamp, '%H:%M:%S') !== '00:00:00')) {
|
||||
$TParam = array_merge($TParam, array(
|
||||
$prefix . 'hour' => intval(dol_print_date($timestamp, '%H')),
|
||||
$prefix . 'minute' => intval(dol_print_date($timestamp, '%M')),
|
||||
$prefix . 'second' => intval(dol_print_date($timestamp, '%S'))
|
||||
$prefix . 'min' => intval(dol_print_date($timestamp, '%M')),
|
||||
$prefix . 'sec' => intval(dol_print_date($timestamp, '%S'))
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -446,6 +446,10 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
|
||||
$tableandshare = 'paiementcharge';
|
||||
$parentfortableentity = 'fk_charge@chargesociales';
|
||||
}
|
||||
if ($features == 'evaluation') {
|
||||
$features = 'hrm';
|
||||
$feature2 = 'evaluation';
|
||||
}
|
||||
|
||||
//print $features.' - '.$tableandshare.' - '.$feature2.' - '.$dbt_select."\n";
|
||||
|
||||
@@ -877,8 +881,11 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
if ($feature == 'project') {
|
||||
$feature = 'projet';
|
||||
}
|
||||
if ($feature == 'task') {
|
||||
$feature = 'projet_task';
|
||||
if ($feature == 'projet' && !empty($feature2) && is_array($feature2) && !empty(array_intersect(array('project_task', 'projet_task'), $feature2))) {
|
||||
$feature = 'project_task';
|
||||
}
|
||||
if ($feature == 'task' || $feature == 'projet_task') {
|
||||
$feature = 'project_task';
|
||||
}
|
||||
if ($feature == 'eventorganization') {
|
||||
$feature = 'agenda';
|
||||
@@ -895,14 +902,14 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
$checkonentitydone = 0;
|
||||
|
||||
// Array to define rules of checks to do
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'payment_sc', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement'); // Test on entity only (Objects with no link to company)
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'payment_sc', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement', 'stock'); // Test on entity only (Objects with no link to company)
|
||||
$checksoc = array('societe'); // Test for object Societe
|
||||
$checkparentsoc = array('agenda', 'contact', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
|
||||
$checkproject = array('projet', 'project'); // Test for project object
|
||||
$checktask = array('projet_task'); // Test for task object
|
||||
$checkhierarchy = array('expensereport', 'holiday'); // check permission among the hierarchy of user
|
||||
$checktask = array('projet_task', 'project_task'); // Test for task object
|
||||
$checkhierarchy = array('expensereport', 'holiday', 'hrm'); // check permission among the hierarchy of user
|
||||
$checkuser = array('bookmark'); // check permission among the fk_user (must be myself or null)
|
||||
$nocheck = array('barcode', 'stock'); // No test
|
||||
$nocheck = array('barcode'); // No test
|
||||
|
||||
//$checkdefault = 'all other not already defined'; // Test on entity + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...).
|
||||
|
||||
@@ -1034,6 +1041,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$sharedelement = 'project'; // for multicompany compatibility
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
|
||||
@@ -1115,6 +1123,20 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($feature == 'hrm' && in_array('evaluation', $feature2)) {
|
||||
$useridtocheck = $object->fk_user;
|
||||
|
||||
if ($user->hasRight('hrm', 'evaluation', 'readall')) {
|
||||
// the user can view evaluations for anyone
|
||||
return true;
|
||||
}
|
||||
if (!$user->hasRight('hrm', 'evaluation', 'read')) {
|
||||
// the user can't view any evaluations
|
||||
return false;
|
||||
}
|
||||
// the user can only their own evaluations or their subordinates'
|
||||
return in_array($useridtocheck, $childids);
|
||||
}
|
||||
}
|
||||
|
||||
// For some object, we also have to check it is public or owned by user
|
||||
|
||||
@@ -463,7 +463,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (isModEnabled('contract') && isModEnabled('ticket') && isModEnabled('workflow') && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT') && getDolGlobalString('TICKET_PRODUCT_CATEGORY') && !empty($object->fk_soc)) {
|
||||
$societe = new Societe($this->db);
|
||||
$company_ids = (!getDolGlobalString('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS')) ? [$object->fk_soc] : $societe->getParentsForCompany($object->fk_soc, [$object->fk_soc]);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
$contrat = new Contrat($this->db);
|
||||
$number_contracts_found = 0;
|
||||
foreach ($company_ids as $company_id) {
|
||||
|
||||
@@ -428,7 +428,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
$message_customer .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
|
||||
|
||||
if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
|
||||
$url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'view.php?track_id='.$object->track_id;
|
||||
$url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'view.php?track_id='.urlencode($object->track_id);
|
||||
$message_customer .= '<p>'.$langs->trans($see_ticket).' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
|
||||
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
|
||||
} else {
|
||||
|
||||
@@ -850,10 +850,9 @@ class EmailCollector extends CommonObject
|
||||
{
|
||||
global $user;
|
||||
|
||||
$nberror = 0;
|
||||
$nbErrors = 0;
|
||||
|
||||
$arrayofcollectors = $this->fetchAll($user, 1);
|
||||
|
||||
// Loop on each collector
|
||||
foreach ($arrayofcollectors as $emailcollector) {
|
||||
$result = $emailcollector->doCollectOneCollector(0);
|
||||
@@ -862,11 +861,12 @@ class EmailCollector extends CommonObject
|
||||
$this->error .= 'EmailCollector ID '.$emailcollector->id.':'.$emailcollector->error.'<br>';
|
||||
if (!empty($emailcollector->errors)) {
|
||||
$this->error .= join('<br>', $emailcollector->errors);
|
||||
$nbErrors++;
|
||||
}
|
||||
$this->output .= 'EmailCollector ID '.$emailcollector->id.': '.$emailcollector->lastresult.'<br>';
|
||||
}
|
||||
|
||||
return $nberror;
|
||||
return $nbErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1755,7 +1755,11 @@ class EmailCollector extends CommonObject
|
||||
$attachments = [];
|
||||
}
|
||||
} else {
|
||||
$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
|
||||
$getMsg = $this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
|
||||
if ($getMsg < 0) {
|
||||
$this->errors = array_merge($this->errors, [$this->error]);
|
||||
return $getMsg;
|
||||
}
|
||||
}
|
||||
//print $plainmsg;
|
||||
//var_dump($plainmsg); exit;
|
||||
@@ -2916,7 +2920,11 @@ class EmailCollector extends CommonObject
|
||||
$attachment->save($destdir.'/');
|
||||
}
|
||||
} else {
|
||||
$this->getmsg($connection, $imapemail, $destdir);
|
||||
$getMsg = $this->getmsg($connection, $imapemail, $destdir);
|
||||
if ($getMsg < 0) {
|
||||
$this->errors = array_merge($this->errors, [$this->error]);
|
||||
return $getMsg;
|
||||
}
|
||||
}
|
||||
|
||||
$operationslog .= '<br>Project created with attachments -> id='.dol_escape_htmltag($projecttocreate->id);
|
||||
@@ -3046,7 +3054,11 @@ class EmailCollector extends CommonObject
|
||||
$attachment->save($destdir.'/');
|
||||
}
|
||||
} else {
|
||||
$this->getmsg($connection, $imapemail, $destdir);
|
||||
$getMsg = $this->getmsg($connection, $imapemail, $destdir);
|
||||
if ($getMsg < 0) {
|
||||
$this->errors = array_merge($this->errors, [$this->error]);
|
||||
return $getMsg;
|
||||
}
|
||||
}
|
||||
|
||||
$operationslog .= '<br>Ticket created with attachments -> id='.dol_escape_htmltag($tickettocreate->id);
|
||||
@@ -3330,9 +3342,9 @@ class EmailCollector extends CommonObject
|
||||
* @param Object $mbox Structure
|
||||
* @param string $mid UID email
|
||||
* @param string $destdir Target dir for attachments
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
private function getmsg($mbox, $mid, $destdir = '')
|
||||
private function getmsg($mbox, $mid, $destdir = ''): int
|
||||
{
|
||||
// input $mbox = IMAP stream, $mid = message id
|
||||
// output all the following:
|
||||
@@ -3346,9 +3358,12 @@ class EmailCollector extends CommonObject
|
||||
|
||||
// BODY
|
||||
$s = imap_fetchstructure($mbox, $mid, FT_UID);
|
||||
if ($s === false) {
|
||||
$this->errors = array_merge($this->errors, [imap_last_error()]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (!$s->parts) {
|
||||
if (empty($s->parts)) {
|
||||
// simple
|
||||
$this->getpart($mbox, $mid, $s, 0); // pass 0 as part-number
|
||||
} else {
|
||||
@@ -3357,6 +3372,8 @@ class EmailCollector extends CommonObject
|
||||
$this->getpart($mbox, $mid, $p, $partno0 + 1, $destdir);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* partno string
|
||||
|
||||
@@ -117,12 +117,14 @@ function getDParameters($part)
|
||||
*/
|
||||
function getAttachments($jk, $mbox)
|
||||
{
|
||||
$structure = imap_fetchstructure($mbox, $jk, FT_UID);
|
||||
$structure = imap_fetchstructure($mbox, $jk, FT_UID); // @phan-suppress-current-line PhanTypeMismatchArgumentInternal
|
||||
$parts = getParts($structure);
|
||||
$fpos = 2;
|
||||
$attachments = array();
|
||||
$nb = count($parts);
|
||||
if ($parts && $nb) {
|
||||
|
||||
if (!empty($parts)) {
|
||||
$nb = count($parts);
|
||||
|
||||
for ($i = 1; $i < $nb; $i++) {
|
||||
$part = $parts[$i];
|
||||
|
||||
@@ -139,6 +141,7 @@ function getAttachments($jk, $mbox)
|
||||
$fpos++;
|
||||
}
|
||||
}
|
||||
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
|
||||
@@ -1929,9 +1929,10 @@ if ($action == 'create') {
|
||||
print '</tr>';
|
||||
|
||||
// List of payments already done
|
||||
$canSeeBankAccount = isModEnabled('bank') && $user->hasRight('banque', 'lire');
|
||||
$nbcols = 3;
|
||||
$nbrows = 0;
|
||||
if (isModEnabled("banque")) {
|
||||
if ($canSeeBankAccount) {
|
||||
$nbrows++;
|
||||
$nbcols++;
|
||||
}
|
||||
@@ -1942,7 +1943,7 @@ if ($action == 'create') {
|
||||
print '<td class="liste_titre">'.$langs->trans('Payments').'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans('Date').'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans('Type').'</td>';
|
||||
if (isModEnabled("banque")) {
|
||||
if ($canSeeBankAccount) {
|
||||
print '<td class="liste_titre right">'.$langs->trans('BankAccount').'</td>';
|
||||
}
|
||||
print '<td class="liste_titre right">'.$langs->trans('Amount').'</td>';
|
||||
@@ -1984,7 +1985,7 @@ if ($action == 'create') {
|
||||
$labeltype = $langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_type;
|
||||
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
|
||||
// Bank account
|
||||
if (isModEnabled("banque")) {
|
||||
if ($canSeeBankAccount) {
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
$bankaccountstatic->ref = $objp->baref;
|
||||
$bankaccountstatic->label = $objp->baref;
|
||||
|
||||
@@ -92,8 +92,8 @@ $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->enti
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
$isdraft = ($object->status == Evaluation::STATUS_DRAFT) ? 1 : 0;
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (!isModEnabled("hrm")) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inv
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||
$result = restrictedArea($user, 'stock', $id);
|
||||
$result = restrictedArea($user, 'stock', $id, 'inventory&stock');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'stock', $id, '', 'inventory_advance');
|
||||
$result = restrictedArea($user, 'stock', $id, 'inventory&stock', 'inventory_advance');
|
||||
}
|
||||
|
||||
// Initialize technical objects
|
||||
|
||||
@@ -59,9 +59,9 @@ $batch = GETPOST('batch', 'alphanohtml');
|
||||
$totalExpectedValuation = 0;
|
||||
$totalRealValuation = 0;
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||
$result = restrictedArea($user, 'stock', $id);
|
||||
$result = restrictedArea($user, 'stock', $id, 'inventory&stock');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'stock', $id, '', 'inventory_advance');
|
||||
$result = restrictedArea($user, 'stock', $id, 'inventory&stock', 'inventory_advance');
|
||||
}
|
||||
|
||||
// Initialize technical objects
|
||||
|
||||
@@ -70,8 +70,7 @@ if (!$sortorder) {
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Security check
|
||||
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
|
||||
$result = restrictedArea($user, 'stock');
|
||||
$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('warehousecard', 'globalcard'));
|
||||
|
||||
@@ -308,7 +308,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
|
||||
}
|
||||
}
|
||||
|
||||
if (!$updateoftaskdone) { // Check to update progress if no update were done on task.
|
||||
if (!$updateoftaskdone && GETPOSTISSET($taskid.'progress')) { // Check to update progress if no update were done on task.
|
||||
$object->fetch($tmptaskid);
|
||||
//var_dump($object->progress);
|
||||
//var_dump(GETPOST($tmptaskid . 'progress', 'int')); exit;
|
||||
|
||||
@@ -438,7 +438,7 @@ function MoreProducts(moreorless) {
|
||||
}
|
||||
var offset = <?php echo ($MAXPRODUCT - 2); ?> * pageproducts;
|
||||
// Only show products for sale (tosell=1)
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
|
||||
console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
|
||||
|
||||
if (typeof (data[0]) == "undefined" && moreorless=="more"){ // Return if no more pages
|
||||
|
||||
Reference in New Issue
Block a user