Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2023-01-18 23:58:40 +01:00
commit 49473e5934
13 changed files with 182 additions and 34 deletions

View File

@ -7,7 +7,7 @@
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2022 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2015-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net> * Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
@ -89,6 +89,18 @@ class Adherent extends CommonObject
*/ */
public $pass_indatabase_crypted; public $pass_indatabase_crypted;
/**
* @var string fullname
*/
public $fullname;
/**
* @var string The civility code, not an integer
*/
public $civility_id;
public $civility_code;
public $civility;
/** /**
* @var string company name * @var string company name
* @deprecated * @deprecated
@ -292,6 +304,10 @@ class Adherent extends CommonObject
public $first_subscription_date; public $first_subscription_date;
public $first_subscription_date_start;
public $first_subscription_date_end;
public $first_subscription_amount; public $first_subscription_amount;
public $last_subscription_date; public $last_subscription_date;
@ -304,6 +320,10 @@ class Adherent extends CommonObject
public $subscriptions = array(); public $subscriptions = array();
/**
* @var string ip
*/
public $ip;
// Fields loaded by fetchPartnerships() from partnership table // Fields loaded by fetchPartnerships() from partnership table

View File

@ -129,6 +129,19 @@ class AdherentType extends CommonObject
/** @var string string other */ /** @var string string other */
public $other = array(); public $other = array();
/**
* @var string description
*/
public $description;
/**
* @var string email
*/
public $email;
/**
* @var array multilangs
*/
public $multilangs = array(); public $multilangs = array();

View File

@ -1446,7 +1446,7 @@ if ($action == 'create') {
} }
if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int'); if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int');
print img_picto('', 'contact', 'class="paddingrightonly"'); 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(empty($conf->global->MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT) ? GETPOST('socid', 'int') : 0, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
print '</td></tr>'; print '</td></tr>';
} }
@ -1949,7 +1949,7 @@ if ($id > 0) {
// related contact // related contact
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>'; print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
print '<div class="maxwidth200onsmartphone">'; 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'); print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(empty($conf->global->MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT) ? $object->socid : 0, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
print '</div>'; print '</div>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -11,7 +11,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2022 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2021-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -236,6 +236,11 @@ class Commande extends CommonOrder
*/ */
public $user_valid; public $user_valid;
/**
* @var OrderLine one line of an order
*/
public $line;
/** /**
* @var OrderLine[] * @var OrderLine[]
*/ */

View File

@ -322,9 +322,6 @@ if (empty($reshook)) {
$result = $object->fetch($id); $result = $object->fetch($id);
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
$result = $object->delete(); // TODO Add $user as first param $result = $object->delete(); // TODO Add $user as first param
if ($result > 0) { if ($result > 0) {
setEventMessages("RecordDeleted", null, 'mesgs'); setEventMessages("RecordDeleted", null, 'mesgs');
@ -408,9 +405,6 @@ if (empty($reshook)) {
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
$object->socid = GETPOST("socid", 'int'); $object->socid = GETPOST("socid", 'int');
$object->lastname = (string) GETPOST("lastname", 'alpha'); $object->lastname = (string) GETPOST("lastname", 'alpha');
$object->firstname = (string) GETPOST("firstname", 'alpha'); $object->firstname = (string) GETPOST("firstname", 'alpha');
@ -972,7 +966,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
/* set country at end because it will trigger page refresh */ /* set country at end because it will trigger page refresh */
console.log("Set country id to '.dol_escape_js($objsoc->country_id).'"); console.log("Set country id to '.dol_escape_js($objsoc->country_id).'");
$(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'").trigger("change"); /* trigger required to update select2 components */ $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'").trigger("change"); /* trigger required to update select2 components */
}); });
})'."\n"; })'."\n";
print '</script>'."\n"; print '</script>'."\n";
} }
@ -982,8 +976,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="contactid" value="'.$object->id.'">'; print '<input type="hidden" name="contactid" value="'.$object->id.'">';
print '<input type="hidden" name="old_lastname" value="'.$object->lastname.'">';
print '<input type="hidden" name="old_firstname" value="'.$object->firstname.'">';
if (!empty($backtopage)) { if (!empty($backtopage)) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
} }
@ -1033,7 +1025,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<div class="paddingrightonly valignmiddle inline-block quatrevingtpercent">'; print '<div class="paddingrightonly valignmiddle inline-block quatrevingtpercent">';
print '<textarea class="flat minwidth200 centpercent" name="address" id="address">'.(GETPOSTISSET("address") ? GETPOST("address", 'alphanohtml') : $object->address).'</textarea>'; print '<textarea class="flat minwidth200 centpercent" name="address" id="address">'.(GETPOSTISSET("address") ? GETPOST("address", 'alphanohtml') : $object->address).'</textarea>';
print '</div><div class="paddingrightonly valignmiddle inline-block">'; print '</div><div class="paddingrightonly valignmiddle inline-block">';
if ($conf->use_javascript_ajax) { if (!empty($conf->use_javascript_ajax)) {
print '<a href="#" id="copyaddressfromsoc">'.$langs->trans('CopyAddressFromSoc').'</a><br>'; print '<a href="#" id="copyaddressfromsoc">'.$langs->trans('CopyAddressFromSoc').'</a><br>';
} }
print '</div>'; print '</div>';
@ -1636,7 +1628,7 @@ function showSocialNetwork()
items.show(); items.show();
lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("HideSocialNetwork")).'"); lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("HideSocialNetwork")).'");
if(chgCookieState) {document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=true; SameSite=Strict";} if(chgCookieState) {document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=true; SameSite=Strict";}
} }
} }
</script>'; </script>';
} }

View File

@ -130,6 +130,16 @@ class Contact extends CommonObject
public $civility_code; public $civility_code;
public $civility; public $civility;
/**
* @var int egroupware_id
*/
public $egroupware_id;
/**
* @var int birthday_alert
*/
public $birthday_alert;
/** /**
* @var string The civilite code, not an integer * @var string The civilite code, not an integer
* @deprecated * @deprecated
@ -137,6 +147,11 @@ class Contact extends CommonObject
*/ */
public $civilite; public $civilite;
/**
* @var string fullname
*/
public $fullname;
/** /**
* @var string Address * @var string Address
*/ */

View File

@ -593,6 +593,15 @@ abstract class CommonObject
protected $labelStatus; protected $labelStatus;
protected $labelStatusShort; protected $labelStatusShort;
/**
* @var array nb used in load_stateboard
*/
public $nb = array();
/**
* @var string output
*/
public $output;
/** /**
* @var array List of child tables. To test if we can delete object. * @var array List of child tables. To test if we can delete object.

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat> * Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -180,6 +180,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*/ */
public $error; public $error;
/**
* @var string[] Array of Errors messages
*/
public $errors;
/** /**
* @var string Module version * @var string Module version
* @see http://semver.org * @see http://semver.org
@ -219,6 +224,15 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*/ */
public $descriptionlong; public $descriptionlong;
/**
* @var array dictionaries description
*/
public $dictionaries;
/**
* @var array tabs description
*/
public $tabs;
// For exports // For exports

View File

@ -2141,6 +2141,16 @@ class CommandeFournisseur extends CommonOrder
return 0; return 0;
} }
// check if not yet received
$dispatchedLines = $this->getDispachedLines();
foreach ($dispatchedLines as $dispatchLine) {
if ($dispatchLine['orderlineid'] == $idline) {
$this->error = "LineAlreadyDispatched";
$this->errors[] = $this->error;
return -3;
}
}
if ($line->delete($notrigger) > 0) { if ($line->delete($notrigger) > 0) {
$this->update_price(1); $this->update_price(1);
return 1; return 1;
@ -2329,7 +2339,7 @@ class CommandeFournisseur extends CommonOrder
// List of already dispatched lines // List of already dispatched lines
$sql = "SELECT p.ref, p.label,"; $sql = "SELECT p.ref, p.label,";
$sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; $sql .= " e.rowid as warehouse_id, e.ref as entrepot,";
$sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_commandefourndet";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p,";
$sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid";
@ -2353,6 +2363,7 @@ class CommandeFournisseur extends CommonOrder
'productid' => $objp->fk_product, 'productid' => $objp->fk_product,
'warehouseid' => $objp->warehouse_id, 'warehouseid' => $objp->warehouse_id,
'qty' => $objp->qty, 'qty' => $objp->qty,
'orderlineid' => $objp->fk_commandefourndet
); );
} }

View File

@ -204,3 +204,5 @@ StatusSupplierOrderApproved=Approved
StatusSupplierOrderRefused=Refused StatusSupplierOrderRefused=Refused
StatusSupplierOrderReceivedPartially=Partially received StatusSupplierOrderReceivedPartially=Partially received
StatusSupplierOrderReceivedAll=All products received StatusSupplierOrderReceivedAll=All products received
NeedAtLeastOneInvoice = There has to be at least one Invoice
LineAlreadyDispatched = The order line is already received.

View File

@ -721,4 +721,39 @@ class Loan extends CommonObject
return -1; return -1;
} }
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'capital')) {
$return .= ' | <span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->capital).'</span>';
}
if (property_exists($this, 'datestart')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateStart").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datestart), 'day').'</span>';
}
if (property_exists($this, 'dateend')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->dateend), 'day').'</span>';
}
if (method_exists($this, 'LibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->LibStatut($this->totalpaid, 5, $this->alreadypaid).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -66,6 +66,7 @@ $search_amount = GETPOST('search_amount', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'alpha'); // mode view result
/* /*
@ -171,6 +172,9 @@ if ($resql) {
$i = 0; $i = 0;
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -194,7 +198,10 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$socid; $url .= '&socid='.$socid;
} }
$newcardbutton = dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $user->rights->loan->write); $newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $user->rights->loan->write);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') { if ($optioncss != '') {
@ -206,6 +213,8 @@ if ($resql) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'money-bill-alt', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'money-bill-alt', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -256,31 +265,49 @@ if ($resql) {
$loan_static->label = $obj->label; $loan_static->label = $obj->label;
$loan_static->paid = $obj->paid; $loan_static->paid = $obj->paid;
print '<tr class="oddeven">';
// Ref if ($mode == 'kanban') {
print '<td>'.$loan_static->getNomUrl(1).'</td>'; if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
$loan_static->datestart= $obj->datestart;
$loan_static->dateend = $obj->dateend;
$loan_static->capital = $obj->capital;
$loan_static->totalpaid = $obj->paid;
// Label print $loan_static->getKanbanView('');
print '<td>'.dol_trunc($obj->label, 42).'</td>'; if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">';
// Capital // Ref
print '<td class="right maxwidth100"><span class="amount">'.price($obj->capital).'</span></td>'; print '<td>'.$loan_static->getNomUrl(1).'</td>';
// Date start // Label
print '<td class="center width100">'.dol_print_date($db->jdate($obj->datestart), 'day').'</td>'; print '<td>'.dol_trunc($obj->label, 42).'</td>';
// Date end // Capital
print '<td class="center width100">'.dol_print_date($db->jdate($obj->dateend), 'day').'</td>'; print '<td class="right maxwidth100"><span class="amount">'.price($obj->capital).'</span></td>';
print '<td class="right nowrap">'; // Date start
print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid); print '<td class="center width100">'.dol_print_date($db->jdate($obj->datestart), 'day').'</td>';
print '</td>';
print '<td></td>'; // Date end
print '<td class="center width100">'.dol_print_date($db->jdate($obj->dateend), 'day').'</td>';
print "</tr>\n"; print '<td class="right nowrap">';
print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid);
print '</td>';
print '<td></td>';
print "</tr>\n";
}
$i++; $i++;
} }

View File

@ -76,6 +76,11 @@ class User extends CommonObject
public $employee; public $employee;
public $civility_code; public $civility_code;
/**
* @var string fullname
*/
public $fullname;
/** /**
* @var string gender * @var string gender
*/ */