diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fb72636ef1a..a9db33b9980 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2014-2018 Alexandre Spangaro * Copyright (C) 2015 Marcos García - * Copyright (C) 2015-2022 Frédéric France + * Copyright (C) 2015-2023 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2018-2019 Thibault FOUCART @@ -89,6 +89,18 @@ class Adherent extends CommonObject */ 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 * @deprecated @@ -292,6 +304,10 @@ class Adherent extends CommonObject public $first_subscription_date; + public $first_subscription_date_start; + + public $first_subscription_date_end; + public $first_subscription_amount; public $last_subscription_date; @@ -304,6 +320,10 @@ class Adherent extends CommonObject public $subscriptions = array(); + /** + * @var string ip + */ + public $ip; // Fields loaded by fetchPartnerships() from partnership table diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index ea60e9c1fcd..f5a5a8933d0 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -129,6 +129,19 @@ class AdherentType extends CommonObject /** @var string string other */ public $other = array(); + /** + * @var string description + */ + public $description; + + /** + * @var string email + */ + public $email; + + /** + * @var array multilangs + */ public $multilangs = array(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 56cf1af5369..2a917435354 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1446,7 +1446,7 @@ if ($action == 'create') { } if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int'); 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 ''; } @@ -1949,7 +1949,7 @@ if ($id > 0) { // related contact print ''.$langs->trans("ActionOnContact").''; print '
'; - 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 '
'; print ''; print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 35ebda89c2c..2a462f77bc4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2016-2022 Ferran Marcet - * Copyright (C) 2021-2022 Frédéric France + * Copyright (C) 2021-2023 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -236,6 +236,11 @@ class Commande extends CommonOrder */ public $user_valid; + /** + * @var OrderLine one line of an order + */ + public $line; + /** * @var OrderLine[] */ diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 3e7f5fdb1f1..66cdc1ed1aa 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -322,9 +322,6 @@ if (empty($reshook)) { $result = $object->fetch($id); $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 if ($result > 0) { setEventMessages("RecordDeleted", null, 'mesgs'); @@ -408,9 +405,6 @@ if (empty($reshook)) { $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->lastname = (string) GETPOST("lastname", '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 */ 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 */ - }); + }); })'."\n"; print ''."\n"; } @@ -982,8 +976,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; print ''; - print ''; - print ''; if (!empty($backtopage)) { print ''; } @@ -1033,7 +1025,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; print ''; print '
'; - if ($conf->use_javascript_ajax) { + if (!empty($conf->use_javascript_ajax)) { print ''.$langs->trans('CopyAddressFromSoc').'
'; } print '
'; @@ -1636,7 +1628,7 @@ function showSocialNetwork() items.show(); lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("HideSocialNetwork")).'"); if(chgCookieState) {document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=true; SameSite=Strict";} - } + } } '; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 8c5c84a0d61..e55f123a540 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -130,6 +130,16 @@ class Contact extends CommonObject public $civility_code; public $civility; + /** + * @var int egroupware_id + */ + public $egroupware_id; + + /** + * @var int birthday_alert + */ + public $birthday_alert; + /** * @var string The civilite code, not an integer * @deprecated @@ -137,6 +147,11 @@ class Contact extends CommonObject */ public $civilite; + /** + * @var string fullname + */ + public $fullname; + /** * @var string Address */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 40c05e06b91..82d3d263e21 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -593,6 +593,15 @@ abstract class CommonObject protected $labelStatus; 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. diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index f4b3b3eef1f..8e6bd78632d 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2018 Josep Lluís Amador - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2022 Frédéric France * * 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 @@ -180,6 +180,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $error; + /** + * @var string[] Array of Errors messages + */ + public $errors; + /** * @var string Module version * @see http://semver.org @@ -219,6 +224,15 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $descriptionlong; + /** + * @var array dictionaries description + */ + public $dictionaries; + + /** + * @var array tabs description + */ + public $tabs; // For exports diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 910cebdb38e..94415f5f1f3 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2141,6 +2141,16 @@ class CommandeFournisseur extends CommonOrder 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) { $this->update_price(1); return 1; @@ -2329,7 +2339,7 @@ class CommandeFournisseur extends CommonOrder // List of already dispatched lines $sql = "SELECT p.ref, p.label,"; $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 .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; $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, 'warehouseid' => $objp->warehouse_id, 'qty' => $objp->qty, + 'orderlineid' => $objp->fk_commandefourndet ); } diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index f988cd62f19..4be2b34fd73 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -204,3 +204,5 @@ StatusSupplierOrderApproved=Approved StatusSupplierOrderRefused=Refused StatusSupplierOrderReceivedPartially=Partially received StatusSupplierOrderReceivedAll=All products received +NeedAtLeastOneInvoice = There has to be at least one Invoice +LineAlreadyDispatched = The order line is already received. \ No newline at end of file diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 1c6913035e8..6dd0f5fe92b 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -721,4 +721,39 @@ class Loan extends CommonObject 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'capital')) { + $return .= ' | '.$langs->trans("Amount").' : '.price($this->capital).''; + } + if (property_exists($this, 'datestart')) { + $return .= '
'.$langs->trans("DateStart").' : '.dol_print_date($this->db->jdate($this->datestart), 'day').''; + } + if (property_exists($this, 'dateend')) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->db->jdate($this->dateend), 'day').''; + } + + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->totalpaid, 5, $this->alreadypaid).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 1324876a98c..1225f5304be 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -66,6 +66,7 @@ $search_amount = GETPOST('search_amount', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'alpha'); // mode view result /* @@ -171,6 +172,9 @@ if ($resql) { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -194,7 +198,10 @@ if ($resql) { if (!empty($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 '
'."\n"; if ($optioncss != '') { @@ -206,6 +213,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + 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->paid = $obj->paid; - print ''; - // Ref - print ''.$loan_static->getNomUrl(1).''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + $loan_static->datestart= $obj->datestart; + $loan_static->dateend = $obj->dateend; + $loan_static->capital = $obj->capital; + $loan_static->totalpaid = $obj->paid; - // Label - print ''.dol_trunc($obj->label, 42).''; + print $loan_static->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - // Capital - print ''.price($obj->capital).''; + // Ref + print ''.$loan_static->getNomUrl(1).''; - // Date start - print ''.dol_print_date($db->jdate($obj->datestart), 'day').''; + // Label + print ''.dol_trunc($obj->label, 42).''; - // Date end - print ''.dol_print_date($db->jdate($obj->dateend), 'day').''; + // Capital + print ''.price($obj->capital).''; - print ''; - print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid); - print ''; + // Date start + print ''.dol_print_date($db->jdate($obj->datestart), 'day').''; - print ''; + // Date end + print ''.dol_print_date($db->jdate($obj->dateend), 'day').''; - print "\n"; + print ''; + print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid); + print ''; + print ''; + + print "\n"; + } $i++; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7f61ba2c7ab..b32c23ab7fc 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -76,6 +76,11 @@ class User extends CommonObject public $employee; public $civility_code; + /** + * @var string fullname + */ + public $fullname; + /** * @var string gender */