Skip to content
Merged

20.0 #18

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e71631a
fix : missing update for extrafields on holidays (#31256)
thomas-Ngr Oct 3, 2024
336d3ad
finish fix (#31203)
thomas-Ngr Oct 3, 2024
9509929
Merge branch '14.0' of [email protected]:Dolibarr/dolibarr.git into 15.0
eldy Oct 7, 2024
1e64870
NEW - Add a new hook on order list (#31315)
atm-lucasmantegari Oct 11, 2024
822e3ca
fix translation for non latin languages (#31343)
sonikf Oct 13, 2024
b2c59aa
Fix: Does not filter correctly by project contacts (#31340)
fmarcet Oct 13, 2024
52a60dc
Undefined stdClass property warnings fixed (#31325)
vladimirdulov Oct 13, 2024
ffcc1ee
CSS
eldy Oct 13, 2024
33c6d95
Backport Fix wrong invoice status when invoice has discount (#31323)
UltraViolet33 Oct 13, 2024
9b0186c
Update makepack-dolibarr.pl (#31320)
frederic34 Oct 13, 2024
24722c1
fix sql close #31374 (#31379)
frederic34 Oct 13, 2024
70a453a
FIX: substitutions THIRDPARTY_XXX are not available for actioncomm re…
thomas-Ngr Oct 14, 2024
cd510a4
Merge branch '20.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Oct 14, 2024
80ced1c
FIX convert amount into text when using numberwords
eldy Oct 14, 2024
f4a76e5
Fix translation file header
eldy Oct 14, 2024
7b81ccc
FIX uniformize and check delete contact action (#31384)
hregis Oct 14, 2024
3f98aee
Doc
eldy Oct 14, 2024
a83c6a8
Merge branch '20.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Oct 14, 2024
793e77b
Merge branch '14.0' of [email protected]:Dolibarr/dolibarr.git into 15.0
eldy Oct 14, 2024
fa22ebd
Merge branch '15.0' of [email protected]:Dolibarr/dolibarr.git into 16.0
eldy Oct 14, 2024
414a289
Doc
eldy Oct 14, 2024
7cd1425
Fix css
eldy Oct 14, 2024
278eea6
Merge branch '16.0' of [email protected]:Dolibarr/dolibarr.git into 17.0
eldy Oct 14, 2024
d819d88
Merge branch '17.0' of [email protected]:Dolibarr/dolibarr.git into 18.0
eldy Oct 14, 2024
b099e10
Merge branch '18.0' of [email protected]:Dolibarr/dolibarr.git into 19.0
eldy Oct 14, 2024
9160147
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Oct 14, 2024
30fd054
Fix look and feel v19
eldy Oct 14, 2024
cd20099
Fix duplicate call/output
eldy Oct 14, 2024
1c9631b
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Oct 14, 2024
86a9069
FIX Support for PDF_ADD_POSITION was not complete
eldy Oct 14, 2024
4972c57
FIX Bad balance of td into setup page of shipments
eldy Oct 14, 2024
3c74d67
FIX Show twice the technical ID
eldy Oct 15, 2024
e731910
Miscellaneous fix on PDf template (trans, position column, warning)
eldy Oct 15, 2024
448616d
Translate
eldy Oct 15, 2024
f3f7b67
add missing dol_escape_all (#31406)
frederic34 Oct 15, 2024
ccc2773
Fix bad escapement
eldy Oct 15, 2024
53a1d06
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Oct 15, 2024
4758144
FIX dol_openinpopup for virtual card
eldy Oct 16, 2024
495a31c
FIX CSS and access to media files
eldy Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion build/makepack-dolibarr.pl
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@
print "Clean $BUILDROOT\n";
$ret=`rm -f $BUILDROOT/$PROJECT/.buildpath`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.cache`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.codeclimate`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.codeclimate.yml`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.git*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.project`;
Expand All @@ -484,8 +484,11 @@
$ret=`rm -fr $BUILDROOT/$PROJECT/.stickler.yml`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.tx`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.pre-commit-config.yaml`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.phan`;
$ret=`rm -f $BUILDROOT/$PROJECT/build.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/phpstan.neon`;
$ret=`rm -fr $BUILDROOT/$PROJECT/phpstan.neon.dist`;
$ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`;

Expand Down
46 changes: 18 additions & 28 deletions htdocs/admin/expedition.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,42 +418,30 @@
}

print '</table>';
print load_fiche_titre($langs->trans('CreationOptions'), '', '');

print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans('Name').'</td>';
print '<td></td>';
print '<td class="center" width="60">'.$langs->trans('Status').'</td>';

print "</tr>\n";

print '<tr class="oddeven">';
print '<td>'.$langs->trans('SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
print '</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="center" >';
print ajax_constantonoff('SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
print '</td></tr>';

print '</table><br>';
print '<br>';


/*
* Other options
*
*/

print load_fiche_titre($langs->trans("OtherOptions"), '', '');

print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set_param">';

print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print "<td>".$langs->trans("Parameter")."</td>\n";
print "</tr>";
print "<td></td>\n";
print '</tr>';

print '<tr class="oddeven">';
print '<td>'.$langs->trans('SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
print '</td>';
print '<td>';
print ajax_constantonoff('SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
print '</td></tr>';

$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
Expand All @@ -463,7 +451,7 @@
}
$htmltext .= '</i>';

print '<tr><td>';
print '<tr><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename = 'SHIPPING_FREE_TEXT';
if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
Expand All @@ -476,14 +464,16 @@
print "</td></tr>\n";

print '<tr><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip');
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('SHIPPING_DRAFT_WATERMARK')).'">';
print "</td></tr>\n";

// Allow OnLine Sign
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowOnLineSign").'</td>';
print '<td class="center">';
print '<td>'.$langs->trans("AllowOnLineSign");
print '</td>';
print '<td>';
print ajax_constantonoff('EXPEDITION_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1);
print '</td></tr>';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/blockedlog/class/blockedlog.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ public function alreadyUsed($ignoresystem = 0)
dol_print_error($this->db);
}

dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".json_encode($result));
dol_syslog("Module Blockedlog alreadyUsed(ignoresystem=".$ignoresystem.") returns ".json_encode($result));

return $result;
}
Expand Down
1 change: 1 addition & 0 deletions htdocs/comm/action/class/actioncomm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2702,6 +2702,7 @@ public function sendEmailsReminder()

// Load event
$res = $this->fetch($actionCommReminder->fk_actioncomm);
if ($res > 0) $res = $this->fetch_thirdparty();
if ($res > 0) {
// PREPARE EMAIL
$errormesg = '';
Expand Down
23 changes: 19 additions & 4 deletions htdocs/commande/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@

// Alias name
if (!empty($arrayfields['s.name_alias']['checked'])) {
print '<td class="nocellnopadd tdoverflowmax125" title="'.dolPrintHTMLForTextArea($obj->alias).'">';
print '<td class="nocellnopadd tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->alias).'">';
print dolPrintLabel($obj->alias);
print '</td>';
if (!$i) {
Expand Down Expand Up @@ -2316,7 +2316,7 @@

// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="tdoverflowmax100">';
print '<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->town).'">';
print dolPrintLabel($obj->town);
print '</td>';
if (!$i) {
Expand All @@ -2326,7 +2326,7 @@

// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd">';
print '<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->zip).'">';
print dolPrintLabel($obj->zip);
print '</td>';
if (!$i) {
Expand All @@ -2336,7 +2336,7 @@

// State
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".dolPrintLabel($obj->state_name)."</td>\n";
print '<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->state_name).'">'.dolPrintLabel($obj->state_name)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
Expand Down Expand Up @@ -2778,6 +2778,21 @@
}
}
}

// Call Hook modifyTextInfo
$parameters = array('textinfo' => $text_info);
$reshook = $hookmanager->executeHooks('modifyTextInfo', $parameters, $object, $action);
if ($reshook == 1) {
// for add information
$text_info .= $hookmanager->resPrint;
} elseif ($reshook == 0) {
// for replace information
$text_info = $hookmanager->resPrint;
} elseif ($reshook == -1) {
// for errors
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}

if ($notshippable == 0) {
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
$text_info = $text_icon.' '.$langs->trans('Shippable').'<br>'.$text_info;
Expand Down
3 changes: 3 additions & 0 deletions htdocs/compta/facture/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -4654,6 +4654,9 @@ function setRadioForTypeOfInvoice() {
$morehtmlref .= '</div>';

$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalcreditnotes = $totalcreditnotes;
$object->totaldeposits = $totaldeposits;
$object->remaintopay = price2num($object->total_ttc - $object->totalpaid - $object->totalcreditnotes - $object->totaldeposits, 'MT');

dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');

Expand Down
5 changes: 3 additions & 2 deletions htdocs/compta/facture/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@
$paiementAmount = $facture->getSommePaiement();
$totalcreditnotes = $facture->getSumCreditNotesUsed();
$totaldeposits = $facture->getSumDepositsUsed();
$totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
$remaintopay = price2num($facture->total_ttc - $totalpay);

$totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
$remaintopay = price2num($facture->total_ttc - $totalallpayments);

// hook to finalize the remaining amount, considering e.g. cash discount agreements
$parameters = array('remaintopay' => $remaintopay);
Expand Down
16 changes: 13 additions & 3 deletions htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,21 @@

print '</td>';
print '<td class="linkedcol-statut right">';
$totalallpayments = 0;
$totalcalculated = false;
if (method_exists($objectlink, 'getSommePaiement')) {
print $objectlink->getLibStatut(3, $objectlink->getSommePaiement());
} else {
print $objectlink->getLibStatut(3);
$totalcalculated = true;
$totalallpayments += $objectlink->getSommePaiement();
}
if (method_exists($objectlink, 'getSumDepositsUsed')) {
$totalcalculated = true;
$totalallpayments += $objectlink->getSumDepositsUsed();
}
if (method_exists($objectlink, 'getSumCreditNotesUsed')) {
$totalcalculated = true;
$totalallpayments += $objectlink->getSumCreditNotesUsed();
}
print $objectlink->getLibStatut(3, ($totalcalculated ? $totalallpayments : -1));
print '</td>';
print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print "</tr>\n";
Expand Down
7 changes: 6 additions & 1 deletion htdocs/compta/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@
$thirdpartystatic->code_compta_client = $obj->code_compta;
//$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;

$totalallpayments = $tmpinvoice->getSommePaiement(0);
$totalallpayments += $tmpinvoice->getSumCreditNotesUsed(0);
$totalallpayments += $tmpinvoice->getSumDepositsUsed(0);
print '<tr class="oddeven">';
print '<td class="nowrap">';

Expand Down Expand Up @@ -251,7 +254,7 @@

print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';

print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
print '<td>'.$tmpinvoice->getLibStatut(3, $totalallpayments).'</td>';

print '</tr>';

Expand Down Expand Up @@ -380,6 +383,8 @@
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
$alreadypaid = $facstatic->getSommePaiement();
$alreadypaid += $facstatic->getSumCreditNotesUsed();
$alreadypaid += $facstatic->getSumDepositsUsed();
print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>';
print '</tr>';
$total_ht += $obj->total_ht;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/paiement/class/paiement.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoi
$facturestatic = new Facture($this->db);
foreach ($arraybill as $billid) {
$facturestatic->fetch($billid);
$label .= '<br> '.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, 1);
$label .= '<br> '.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, -1);
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions htdocs/compta/prelevement/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/*
* Invoices waiting for withdraw
*/
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut as status, f.paye, f.type,";
$sql .= " pfd.date_demande, pfd.amount,";
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
Expand Down Expand Up @@ -141,10 +141,13 @@

$invoicestatic->id = $obj->rowid;
$invoicestatic->ref = $obj->ref;
$invoicestatic->statut = $obj->fk_statut;
$invoicestatic->statut = $obj->status;
$invoicestatic->status = $obj->status;
$invoicestatic->paye = $obj->paye;
$invoicestatic->type = $obj->type;
$alreadypayed = $invoicestatic->getSommePaiement();
$totalallpayments = $invoicestatic->getSommePaiement(0);
$totalallpayments += $invoicestatic->getSumCreditNotesUsed(0);
$totalallpayments += $invoicestatic->getSumDepositsUsed(0);

$thirdpartystatic->id = $obj->socid;
$thirdpartystatic->name = $obj->name;
Expand Down Expand Up @@ -177,7 +180,7 @@
print '</td>';

print '<td class="right">';
print $invoicestatic->getLibStatut(3, $alreadypayed);
print $invoicestatic->getLibStatut(3, $totalallpayments);
print '</td>';
print '</tr>';
$i++;
Expand Down
6 changes: 4 additions & 2 deletions htdocs/compta/recap-compta.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@
print $fac->error."<br>";
continue;
}
$totalpaid = $fac->getSommePaiement();
$alreadypaid = $fac->getSommePaiement();
$alreadypaid += $fac->getSumDepositsUsed();
$alreadypaid += $fac->getSumCreditNotesUsed();

$userstatic->id = $objf->userid;
$userstatic->login = $objf->login;
Expand All @@ -169,7 +171,7 @@
'date' => $fac->date,
'datefieldforsort' => $fac->date.'-'.$fac->ref,
'link' => $fac->getNomUrl(1),
'status' => $fac->getLibStatut(2, $totalpaid),
'status' => $fac->getLibStatut(2, $alreadypaid),
'amount' => $fac->total_ttc,
'author' => $userstatic->getLoginUrl(1)
);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/compta/tva/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,8 @@
}

if (!empty($arrayfields['t.status']['checked'])) {
print '<td class="nowrap right">' . $tva_static->getLibStatut(5, $obj->alreadypayed) . '</td>';
$totalallpayments = $obj->alreadypayed;
print '<td class="nowrap right">' . $tva_static->getLibStatut(5, $totalallpayments) . '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
Expand Down
4 changes: 3 additions & 1 deletion htdocs/contact/class/contact.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoro
$sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,";
$sql .= " c.fk_prospectlevel, c.fk_stcommcontact, st.libelle as stcomm, st.picto as stcomm_picto,";
$sql .= " c.import_key,";
$sql .= " c.datec as date_creation, c.tms as date_modification,";
$sql .= " c.datec as date_creation, c.tms as date_modification, c.fk_user_creat, c.fk_user_modif,";
$sql .= " co.label as country, co.code as country_code,";
$sql .= " d.nom as state, d.code_departement as state_code,";
$sql .= " u.rowid as user_id, u.login as user_login,";
Expand Down Expand Up @@ -1053,6 +1053,8 @@ public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoro

$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
$this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;

$this->state_id = $obj->state_id;
$this->state_code = $obj->state_code;
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/boxes/box_contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public function loadBox($max = 5)
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact
// Add where from hooks
$parameters = array('socid' => $user->socid, 'boxcode' => $this->boxcode);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/class/html.form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,7 @@ public function select_thirdparty_list($selected = '', $htmlname = 'socid', $fil
*/
public function selectcontacts($socid, $selected = array(), $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = 0, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0, $filter = '')
{
global $conf, $langs, $hookmanager, $action;
global $conf, $user, $langs, $hookmanager, $action;

$langs->load('companies');

Expand Down Expand Up @@ -1812,6 +1812,7 @@ public function selectcontacts($socid, $selected = array(), $htmlname = 'contact
$sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
}
$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact
if ($socid > 0 || $socid == -1) {
$sql .= " AND sp.fk_soc = " . ((int) $socid);
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/lib/company.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Copyright (C) 2015-2024 Frédéric France <[email protected]>
* Copyright (C) 2015 Raphaël Doursenaud <[email protected]>
* Copyright (C) 2017 Rui Strecht <[email protected]>
* Copyright (C) 2018 Ferran Marcet <[email protected]>
* Copyright (C) 2018-2024 Ferran Marcet <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -1026,7 +1026,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc on ec.fk_c_type_contact = tc.rowid";
$sql .= " WHERE sc.fk_soc = ".((int) $object->id);
$sql .= " AND p.entity IN (".getEntity('project').")";
$sql .= " AND tc.element = 'project'";
$sql .= " AND tc.element = 'project' AND tc.source = 'external'";
$sql .= " ORDER BY p.dateo DESC";

$result = $db->query($sql);
Expand Down Expand Up @@ -1667,7 +1667,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl

// Delete
if ($user->hasRight('societe', 'contact', 'delete')) {
print '<a class="marginleftonly right" href="'.DOL_URL_ROOT.'/societe/contact.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&socid='.urlencode($obj->fk_soc).'">';
print '<a class="marginleftonly right" href="'.DOL_URL_ROOT.'/societe/contact.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
print img_delete();
print '</a>';
}
Expand Down
Loading