diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index a946aa86333..19bd61c641b 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -354,6 +354,22 @@ class Documents extends DolibarrApi $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); } + else if ($modulepart == 'produit' || $modulepart == 'product') + { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + + if (!DolibarrApiAccess::$user->rights->produit->lire) { + throw new RestException(401); + } + + $object = new Product($this->db); + $result=$object->fetch($id, $ref); + if ( ! $result ) { + throw new RestException(404, 'Product not found'); + } + + $upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product'); + } else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 5bbc91ea946..12f27df03d7 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -118,12 +118,12 @@ if (empty($reshook)) $error=0; $permissiontoadd = $user->rights->bom->write; - $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); - $backurlforlist = dol_buildpath('/bom/bom_list.php', 1); + $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); + $backurlforlist = dol_buildpath('/bom/bom_list.php', 1); if (empty($backtopage)) { if (empty($id)) $backtopage = $backurlforlist; else $backtopage = dol_buildpath('/bom/bom_card.php', 1).($id > 0 ? $id : '__ID__'); - } + } $triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, delete or clone diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f660fd3c533..37f6b2bd3f5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1357,7 +1357,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise $sql.= ", p.date_livraison as date_livraison"; $sql.= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams"; $sql.= ", p.note_private, p.note_public"; - $sql.= ", p.fk_projet, p.fk_statut"; + $sql.= ", p.fk_projet as fk_project, p.fk_statut"; $sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; $sql.= ", p.fk_delivery_address"; $sql.= ", p.fk_availability"; @@ -1412,7 +1412,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total; $this->socid = $obj->fk_soc; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->modelpdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; $this->note = $obj->note_private; // TODO deprecated diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 5f52246432b..ae1360ff633 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -247,7 +247,7 @@ class Deplacement extends CommonObject */ public function fetch($id, $ref = '') { - $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams"; + $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; $sql.= " WHERE entity IN (".getEntity('deplacement').")"; if ($ref) $sql.= " AND ref ='".$this->db->escape($ref)."'"; @@ -269,7 +269,7 @@ class Deplacement extends CommonObject $this->statut = $obj->fk_statut; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->extraparams = (array) json_decode($obj->extraparams, true); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 47e91459b8e..08f75f1e28e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1159,30 +1159,6 @@ class Facture extends CommonInvoice else return -1; } - /** - * Return link to download file from a direct external access - * - * @param int $withpicto Add download picto into link - * @return string HTML link to file - */ - function getDirectExternalLink($withpicto = 0) - { - global $dolibarr_main_url_root; - - // Define $urlwithroot - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - - // TODO Read into ecmfile table to get entry and hash exists (PS: If not found, add it) - include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; - $ecmfile=new EcmFiles($this->db); - //$result = $ecmfile->get(); - - $hashp='todo'; - return ''.$this->ref.''; - } - /** * Return clicable link of object (with eventually picto) * diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 41ff8061244..897dfaf557b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -718,7 +718,7 @@ if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'],$_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 405cfeca0b4..ea7879db05e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -621,7 +621,7 @@ class Contrat extends CommonObject $sql.= " ref_ext,"; $sql.= " fk_user_mise_en_service, date_contrat as datecontrat,"; $sql.= " fk_user_author, fin_validite, date_cloture,"; - $sql.= " fk_projet,"; + $sql.= " fk_projet as fk_project,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,"; $sql.= " note_private, note_public, model_pdf, extraparams"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; @@ -672,8 +672,8 @@ class Contrat extends CommonObject $this->note_public = $obj->note_public; $this->modelpdf = $obj->model_pdf; - $this->fk_projet = $obj->fk_projet; // deprecated - $this->fk_project = $obj->fk_projet; + $this->fk_projet = $obj->fk_project; // deprecated + $this->fk_project = $obj->fk_project; $this->socid = $obj->fk_soc; $this->fk_soc = $obj->fk_soc; diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 5c9797a2407..63172d17566 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -303,17 +303,6 @@ class EmailSenderProfile extends CommonObject return $result; } - /** - * Return link to download file from a direct external access - * - * @param int $withpicto Add download picto into link - * @return string HTML link to file - */ - function getDirectExternalLink($withpicto = 0) - { - return 'todo'; - } - /** * Retourne le libelle du status d'un user (actif, inactif) * diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 12a1604d84d..a30715c012c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3682,6 +3682,75 @@ class Form return $num; } + /** + * Return a HTML select list of establishment + * + * @param string $selected Id establishment pre-selected + * @param string $htmlname Name of select zone + * @param int $statut Status of searched establishment (0=open, 1=closed, 2=both) + * @param string $filtre To filter list + * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. + * @param string $moreattrib To add more attribute on select + * @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...) + */ + function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '') + { + // phpcs:enable + global $langs, $conf; + + $langs->load("admin"); + $num = 0; + + $sql = "SELECT rowid, name, fk_country, status, entity"; + $sql.= " FROM ".MAIN_DB_PREFIX."establishment"; + $sql.= " WHERE 1=1"; + if ($statut != 2) $sql.= " AND status = '".$statut."'"; + if ($filtre) $sql.=" AND ".$filtre; + $sql.= " ORDER BY name"; + + dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); + $i = 0; + if ($num) + { + print '"; + } + else + { + if ($statut == 0) print ''.$langs->trans("NoActiveEstablishmentDefined").''; + else print ''.$langs->trans("NoEstablishmentFound").''; + } + } + else { + dol_print_error($this->db); + } + } + /** * Display form to select bank account * diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d12aeb6be41..7e150fc9a7f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3081,7 +3081,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ elseif ($pictowithoutext == 'jabber') { $fakey = 'fa-comment-o'; } - elseif ($pictowithoutext == 'skype') { + elseif (in_array($pictowithoutext, array('skype', 'twitter', 'facebook', 'linkedin'))) { $fakey = 'fa-'.$pictowithoutext; if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa = 'fab'; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 169511fe160..afb1469da26 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -527,7 +527,7 @@ class Expedition extends CommonObject // Check parameters if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet, e.billed"; + $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed"; $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery"; $sql.= ", e.fk_shipping_method, e.tracking_number"; @@ -575,7 +575,7 @@ class Expedition extends CommonObject $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility $this->origin_id = $obj->origin_id; $this->billed = $obj->billed; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->trueWeight = $obj->weight; $this->weight_units = $obj->weight_units; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index e2caa591ad6..43cd79bfe70 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -379,7 +379,7 @@ class Fichinter extends CommonObject $sql.= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; $sql.= " f.date_valid as datev,"; $sql.= " f.tms as datem,"; - $sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat"; + $sql.= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; if ($ref) { $sql.= " WHERE f.entity IN (".getEntity('intervention').")"; @@ -407,8 +407,8 @@ class Fichinter extends CommonObject $this->datet = $this->db->jdate($obj->datet); $this->datev = $this->db->jdate($obj->datev); $this->datem = $this->db->jdate($obj->datem); - $this->fk_project = $obj->fk_projet; - $this->note_public = $obj->note_public; + $this->fk_project = $obj->fk_project; + $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; $this->modelpdf = $obj->model_pdf; $this->fk_contrat = $obj->fk_contrat; diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 4ea0b76a9d4..1985926563b 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -78,7 +78,7 @@ dol_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user"); $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status"; $sql.= " FROM ".MAIN_DB_PREFIX."establishment as e"; -$sql.= " WHERE e.entity = ".$conf->entity; +$sql.= " WHERE e.entity IN (".getEntity('establishment').')'; $sql.= $db->order($sortfield, $sortorder); $sql.= $db->plimit($limit+1, $offset); diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index bb0bfd342ac..2f21d83436b 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -208,6 +208,7 @@ class Establishment extends CommonObject $sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null'); $sql .= ", status = ".$this->db->escape($this->status); $sql .= ", fk_user_mod = " . $user->id; + $sql .= ", entity = " . $this->entity; $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); @@ -230,7 +231,7 @@ class Establishment extends CommonObject */ public function fetch($id) { - $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id,"; + $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id, e.entity,"; $sql.= ' c.code as country_code, c.label as country'; $sql.= " FROM ".MAIN_DB_PREFIX."establishment as e"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON e.fk_country = c.rowid'; @@ -249,6 +250,7 @@ class Establishment extends CommonObject $this->zip = $obj->zip; $this->town = $obj->town; $this->status = $obj->status; + $this->entity = $obj->entity; $this->country_id = $obj->country_id; $this->country_code = $obj->country_code; @@ -352,7 +354,7 @@ class Establishment extends CommonObject */ public function info($id) { - $sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod'; + $sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity'; $sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e'; $sql.= ' WHERE e.rowid = '.$id; @@ -389,6 +391,37 @@ class Establishment extends CommonObject dol_print_error($this->db); } } + + /** + * Get on record Establishment + * + * @param int $id Id of record + * @return obj + */ + function getEstablishment($id) + { + $sql = 'SELECT e.rowid, e.name, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e'; + $sql.= ' WHERE e.rowid = '.$id; + + dol_syslog(get_class($this)."::fetch info", LOG_DEBUG); + $result = $this->db->query($sql); + + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + } + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + + return $obj; + } /** * Return clicable name (with picto eventually) @@ -414,6 +447,34 @@ class Establishment extends CommonObject if ($withpicto != 2) $result.=$link.$this->name.$linkend; return $result; } + + /** + * Return clicable name (with picto eventually) + * + * @param int $id Id of record + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @return string String with URL + */ + function getNomUrlParent($id = 0, $withpicto = 0) + { + global $langs; + + $result=''; + + $obj = $this->getEstablishment(($id>0)?$id:$conf->entity); + + $link = ''; + $linkend=''; + + $picto='building'; + + $label=$langs->trans("Show").': '.$obj->name; + + if ($withpicto) $result.=($link.img_object($label, $picto).$linkend); + if ($withpicto && $withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=$link.$obj->name.$linkend; + return $result; + } /** * Return account country code diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 28763f8b0f3..37a3d7f538b 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -92,8 +92,7 @@ elseif ($action == 'add') $object->status = GETPOST('status', 'int'); $object->fk_user_author = $user->id; $object->datec = dol_now(); - - + $object->entity = GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity; $id = $object->create($user); @@ -141,6 +140,7 @@ elseif ($action == 'update') $object->country_id = GETPOST('country_id', 'int'); $object->fk_user_mod = $user->id; $object->status = GETPOST('status', 'int'); + $object->entity = GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity; $result = $object->update($user); @@ -190,6 +190,14 @@ if ($action == 'create') print ''; print ''; + // Parent + print ''; + print ''.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; + print ''; + print $form->selectEstablishments(GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity, 'entity', 1); + print ''; + print ''; + // Address print ''; print ''.$form->editfieldkey('Address', 'address', '', $object, 0).''; @@ -202,7 +210,7 @@ if ($action == 'create') print ''; print ''.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; print ''; -print $formcompany->select_ziptown( + print $formcompany->select_ziptown( GETPOST('zipcode', 'alpha'), 'zipcode', array ( @@ -218,7 +226,7 @@ print $formcompany->select_ziptown( print ''; print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; print ''; -print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array ( + print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array ( 'zipcode', 'selectcountry_id' )); @@ -282,6 +290,12 @@ if (($id || $ref) && $action == 'edit') // Name print ''.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).''; print ''; + print ''; + + // Parent + print ''.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; + print ''; + print $form->selectEstablishments($object->entity>0?$object->entity:$conf->entity, 'entity', 1); print ''; // Address @@ -292,12 +306,12 @@ if (($id || $ref) && $action == 'edit') // Zipcode / Town print ''.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; -print $formcompany->select_ziptown($object->zip, 'zipcode', array ( + print $formcompany->select_ziptown($object->zip, 'zipcode', array ( 'town', 'selectcountry_id' ), 6) . ''; print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; -print $formcompany->select_ziptown($object->town, 'town', array ( + print $formcompany->select_ziptown($object->town, 'town', array ( 'zipcode', 'selectcountry_id' )) . ''; @@ -366,6 +380,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Name").''; print ''.$object->name.''; print ''; + + // Parent + print ''; + print ''.$langs->trans("Parent").''; + print ''.$object->getNomUrlParent($object->entity).''; + print ''; // Address print ''; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 1229ace57ee..2fa5fad38ac 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2846,7 +2846,7 @@ function migrate_project_task_actors($db, $langs, $conf) $db->begin(); - $sql = "SELECT fk_projet_task, fk_user FROM ".MAIN_DB_PREFIX."projet_task_actors"; + $sql = "SELECT fk_projet_task as fk_project_task, fk_user FROM ".MAIN_DB_PREFIX."projet_task_actors"; $resql = $db->query($sql); if ($resql) { @@ -2868,7 +2868,7 @@ function migrate_project_task_actors($db, $langs, $conf) $sql2.= ") VALUES ("; $sql2.= "'".$db->idate(dol_now())."'"; $sql2.= ", '4'"; - $sql2.= ", ".$obj->fk_projet_task; + $sql2.= ", ".$obj->fk_project_task; $sql2.= ", '180'"; $sql2.= ", ".$obj->fk_user; $sql2.= ")"; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 972712edeea..6638a4c1a04 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -885,7 +885,6 @@ LineNb=Line no. IncotermLabel=Incoterms TabLetteringCustomer=Customer lettering TabLetteringSupplier=Vendor lettering -# Week day Monday=Monday Tuesday=Tuesday Wednesday=Wednesday @@ -965,3 +964,4 @@ SelectAThirdPartyFirst=Select a third party first... YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode Inventory=Inventory AnalyticCode=Analytic code +TMenuMRP=MRP \ No newline at end of file diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 862d137a510..53ac720d862 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -109,3 +109,4 @@ UserLogoff=User logout UserLogged=User logged DateEmployment=Employment Start Date DateEmploymentEnd=Employment End Date +CantDisableYourself=You can disable your own user record \ No newline at end of file diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index f0797f3f5b2..a1211ead4ee 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -238,7 +238,7 @@ class Task extends CommonObject $sql = "SELECT"; $sql.= " t.rowid,"; $sql.= " t.ref,"; - $sql.= " t.fk_projet,"; + $sql.= " t.fk_projet as fk_project,"; $sql.= " t.fk_task_parent,"; $sql.= " t.label,"; $sql.= " t.description,"; @@ -281,7 +281,7 @@ class Task extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->fk_task_parent = $obj->fk_task_parent; $this->label = $obj->label; $this->description = $obj->description; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 6166aae1e8a..8f4d1de13f4 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -838,6 +838,7 @@ if ($source == 'order') // Debitor print ''.$langs->trans("ThirdParty"); print ''.$order->thirdparty->name.''; + print ''."\n"; // Object $text=''.$langs->trans("PaymentOrderRef", $order->ref).''; @@ -958,6 +959,7 @@ if ($source == 'invoice') // Debitor print ''.$langs->trans("ThirdParty"); print ''.$invoice->thirdparty->name.''; + print ''."\n"; // Object $text=''.$langs->trans("PaymentInvoiceRef", $invoice->ref).''; @@ -1009,15 +1011,6 @@ if ($source == 'invoice') print ''; print ''."\n"; - // Add download link - if ($download > 0) - { - print ''.$langs->trans("Document"); - print ''; - print $invoice->getDirectExternalLink(1); - print ''."\n"; - } - // Shipping address $shipToName=$invoice->thirdparty->name; $shipToStreet=$invoice->thirdparty->address; @@ -1295,22 +1288,20 @@ if ($source == 'membersubscription') $fulltag=dol_string_unaccent($fulltag); // Creditor - print ''.$langs->trans("Creditor"); print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("Member"); print ''; if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe; else print $member->getFullName($langs); print ''; + print ''."\n"; // Object - $text=''.$langs->trans("PaymentSubscription").''; if (GETPOST('desc', 'alpha')) $text=''.$langs->trans(GETPOST('desc', 'alpha')).''; print ''.$langs->trans("Designation"); @@ -1343,7 +1334,6 @@ if ($source == 'membersubscription') } // Amount - print ''.$langs->trans("Amount"); if (empty($amount)) { @@ -1391,7 +1381,6 @@ if ($source == 'membersubscription') print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); print ''.$fulltag.''; print ''; @@ -1463,22 +1452,20 @@ if ($source == 'donation') $fulltag=dol_string_unaccent($fulltag); // Creditor - print ''.$langs->trans("Creditor"); print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("ThirdParty"); print ''; if ($don->morphy == 'mor' && ! empty($don->societe)) print $don->societe; else print $don->getFullName($langs); print ''; + print ''."\n"; // Object - $text=''.$langs->trans("PaymentDonation").''; if (GETPOST('desc', 'alpha')) $text=''.$langs->trans(GETPOST('desc', 'alpha')).''; print ''.$langs->trans("Designation"); @@ -1488,7 +1475,6 @@ if ($source == 'donation') print ''."\n"; // Amount - print ''.$langs->trans("Amount"); if (empty($amount)) { @@ -1536,7 +1522,6 @@ if ($source == 'donation') print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); print ''.$fulltag.''; print ''; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 89960a69aee..80d98875e39 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -401,17 +401,6 @@ class SocieteAccount extends CommonObject return $result; } - /** - * Return link to download file from a direct external access - * - * @param int $withpicto Add download picto into link - * @return string HTML link to file - */ - function getDirectExternalLink($withpicto = 0) - { - return 'todo'; - } - /** * Retourne le libelle du status d'un user (actif, inactif) * diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index bf731262cbd..24ce18bf676 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1226,7 +1226,7 @@ class SupplierProposal extends CommonObject $sql.= ", p.date_livraison as date_livraison"; $sql.= ", p.model_pdf, p.extraparams"; $sql.= ", p.note_private, p.note_public"; - $sql.= ", p.fk_projet, p.fk_statut"; + $sql.= ", p.fk_projet as fk_project, p.fk_statut"; $sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; $sql.= ", p.fk_cond_reglement"; $sql.= ", p.fk_mode_reglement"; @@ -1266,7 +1266,7 @@ class SupplierProposal extends CommonObject $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total; $this->socid = $obj->fk_soc; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_project; $this->modelpdf = $obj->model_pdf; $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private; diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php index 546c5ed6fca..506c067790a 100644 --- a/htdocs/takepos/genimg/index.php +++ b/htdocs/takepos/genimg/index.php @@ -54,19 +54,19 @@ if ($query=="cat") $dir = $upload_dir.'/'.$pdir; foreach ($object->liste_photos($dir) as $key => $obj) + { + if ($obj['photo_vignette']) { - if ($obj['photo_vignette']) - { - $filename=$obj['photo_vignette']; - } - else - { - $filename=$obj['photo']; - } - $file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); - header('Location: '.$file); - exit; + $filename=$obj['photo_vignette']; } + else + { + $filename=$obj['photo']; + } + $file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); + header('Location: '.$file); + exit; + } header('Location: ../../public/theme/common/nophoto.png'); } elseif ($query=="pro") @@ -81,7 +81,6 @@ elseif ($query=="pro") $file = array_pop($match); if ($file=="") header('Location: ../../public/theme/common/nophoto.png'); else header('Location: '.$file); - } else { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 81107d8c0d6..51f9d8d2990 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -271,7 +271,7 @@ body { .thumbstat { font-weight: bold !important; } th a { font-weight: !important; } -a.tab { font-weight: bold !important; } +a.tab { font-weight: 500 !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } @@ -1591,8 +1591,10 @@ div.tmenudiv { div.tmenudisabled, a.tmenudisabled { opacity: 0.6; } +a.tmenu, a.tmenusel, a.tmenudisabled { + font-weight: 300; +} a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudisabled:active { - font-weight: normal; padding: 0px 5px 0px 5px; white-space: nowrap; color: #; @@ -1601,14 +1603,12 @@ a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudis } a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active { - font-weight: normal; padding: 0px 4px 0px 4px; white-space: nowrap; color: #; text-decoration: none; } a.tmenusel:link, a.tmenusel:visited, a.tmenusel:hover, a.tmenusel:active { - font-weight: normal; padding: 0px 4px 0px 4px; margin: 0px 0px 0px 0px; white-space: nowrap; @@ -2162,8 +2162,8 @@ input.vmenusearchselectcombo[type=text] { .searchform input { font-size: 16px; } -a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu { white-space: nowrap; font-family: ; text-align: ; font-weight: bold; } -font.vmenudisabled { font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } +a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu { white-space: nowrap; font-family: ; text-align: ; font-weight: bold; } /* bold = 600, 500 is ko with Edge on 1200x960 */ +font.vmenudisabled { font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } /* bold = 600, 500 is ko with Edge on 1200x960 */ a.vmenu:link, a.vmenu:visited { color: #; } a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { font-family: ; text-align: ; font-weight: normal; color: #202020; margin: 1px 1px 1px 6px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 85ab07bb09a..5bd5c386641 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -264,7 +264,7 @@ body { .thumbstat { font-weight: bold !important; } th a { font-weight: !important; } -a.tab { font-weight: bold !important; } +a.tab { font-weight: 500 !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 2f91cf9af61..46fc74626bb 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -48,6 +48,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); @@ -91,7 +92,7 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden(); // Load translation files required by page -$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm')); +$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks')); $object = new User($db); $extrafields = new ExtraFields($db); @@ -238,6 +239,8 @@ if (empty($reshook)) { $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth'), GETPOST('dateemploymentendday'), GETPOST('dateemploymentendyear')); $object->dateemploymentend = $dateemploymentend; + $object->fk_warehouse = GETPOST('fk_warehouse', 'int'); + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { @@ -386,6 +389,11 @@ if (empty($reshook)) { $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth', 'int'), GETPOST('dateemploymentendday', 'int'), GETPOST('dateemploymentendyear', 'int')); $object->dateemploymentend = $dateemploymentend; + if (! empty($conf->stock->enabled)) + { + $object->fk_warehouse = GETPOST('fk_warehouse', 'int'); + } + if (! empty($conf->multicompany->enabled)) { if (! empty($_POST["superadmin"])) @@ -642,6 +650,7 @@ $form = new Form($db); $formother=new FormOther($db); $formcompany = new FormCompany($db); $formfile = new FormFile($db); +if (! empty($conf->stock->enabled)) $formproduct = new FormProduct($db); llxHeader('', $langs->trans("UserCard")); @@ -1185,6 +1194,13 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print ''; + // Default warehouse + if (! empty($conf->stock->enabled)) + { + print ''.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); + print ''; + } if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))) @@ -1538,6 +1554,17 @@ else print ''.$object->job.''; print ''."\n"; + // Default warehouse + if (! empty($conf->stock->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/product/stock/class/entrepot.class.php'; + $warehousestatic=new Entrepot($db); + $warehousestatic->fetch($object->fk_warehouse); + print ''.$langs->trans("DefaultWarehouse").''; + print $warehousestatic->getNomUrl(); + print ''; + } + //$childids = $user->getAllChildIds(1); if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) @@ -1801,18 +1828,25 @@ else } } - // Activer + // Enable user if ($user->id <> $id && $candisableuser && $object->statut == 0 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { print '
'.$langs->trans("Reactivate").'
'; } - // Desactiver + // Disable user if ($user->id <> $id && $candisableuser && $object->statut == 1 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { print '
'.$langs->trans("DisableUser").'
'; } + else + { + if ($user->id == $id) + { + print '
'.$langs->trans("DisableUser").'
'; + } + } // Delete if ($user->id <> $id && $candisableuser && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) @@ -2556,6 +2590,15 @@ else } print ''; + // Default warehouse + if (! empty($conf->stock->enabled)) + { + print ''.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); + print ' '.$langs->trans("AddWarehouse").''; + print ''; + } + if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index e7f927b2f60..859b792963f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -174,6 +174,8 @@ class User extends CommonObject public $default_c_exp_tax_cat; public $default_range; + + public $fk_warehouse; public $fields = array( 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), @@ -249,6 +251,7 @@ class User extends CommonObject $sql.= " u.weeklyhours,"; $sql.= " u.color,"; $sql.= " u.dateemployment, u.dateemploymentend,"; + $sql.= " u.fk_warehouse,"; $sql.= " u.ref_int, u.ref_ext,"; $sql.= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode $sql.= " c.code as country_code, c.label as country,"; @@ -368,8 +371,9 @@ class User extends CommonObject $this->fk_member = $obj->fk_member; $this->fk_user = $obj->fk_user; - $this->default_range = $obj->default_range; - $this->default_c_exp_tax_cat = $obj->default_c_exp_tax_cat; + $this->default_range = $obj->default_range; + $this->default_c_exp_tax_cat = $obj->default_c_exp_tax_cat; + $this->fk_warehouse = $obj->fk_warehouse; // Protection when module multicompany was set, admin was set to first entity and then, the module was disabled, // in such case, this admin user must be admin for ALL entities. @@ -1484,6 +1488,7 @@ class User extends CommonObject $this->color = empty($this->color)?'':$this->color; $this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment; $this->dateemploymentend = empty($this->dateemploymentend)?'':$this->dateemploymentend; + $this->fk_warehouse = trim(empty($this->fk_warehouse)?'':$this->fk_warehouse); // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1542,6 +1547,7 @@ class User extends CommonObject $sql.= ", entity = '".$this->db->escape($this->entity)."'"; $sql.= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null'); $sql.= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); + $sql.= ", fk_warehouse = ".($this->fk_warehouse?"'".$this->db->escape($this->fk_warehouse)."'":"null"); $sql.= " WHERE rowid = ".$this->id; @@ -1982,8 +1988,8 @@ class User extends CommonObject dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); } - $mailfile = new CMailFile( - $subject, + $mailfile = new CMailFile( + $subject, $this->email, $conf->global->MAIN_MAIL_EMAIL_FROM, $mesg, diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index a41345820b4..25ee449b889 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -35,12 +35,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $canreadperms=($user->admin || $user->rights->user->user->lire); $caneditperms=($user->admin || $user->rights->user->user->creer); $candisableperms=($user->admin || $user->rights->user->user->supprimer); +$feature2 = 'user'; + // Advanced permissions if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $canreadperms=($user->admin || $user->rights->user->group_advance->read); $caneditperms=($user->admin || $user->rights->user->group_advance->write); $candisableperms=($user->admin || $user->rights->user->group_advance->delete); + $feature2 = 'group_advance'; } // Load translation files required by page @@ -55,7 +58,7 @@ $contextpage = GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'groupc $userid = GETPOST('user', 'int'); // Security check -$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); +$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2); // Users/Groups management only in master entity if transverse mode if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)