diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 37e44ac9768..a8002c179be 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1116,7 +1116,7 @@ if ($resql) if (! empty($arrayfields['b.rowid']['checked'])) { print ''; - print "rowid.'&save_lastsearch_values=1">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."   "; + print "rowid.'&save_lastsearch_values=1">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."   "; print ''; if (! $i) $totalarray['nbfield']++; } @@ -1126,7 +1126,7 @@ if ($resql) { print ""; - //print "rowid."&account=".$objp->fk_account."\">"; + //print "rowid."&account=".$objp->fk_account."\">"; $reg=array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); @@ -1459,7 +1459,7 @@ if ($resql) // Transaction reconciliated or edit link if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated { - print ''; + print ''; print img_edit(); print ''; } @@ -1467,13 +1467,13 @@ if ($resql) { if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { - print ''; + print ''; print img_edit(); print ''; } else { - print ''; + print ''; print img_view(); print ''; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 89a05f3e215..5724178e9de 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -2277,7 +2277,7 @@ class AccountLine extends CommonObject $result=''; $label=$langs->trans("ShowTransaction").': '.$this->rowid; - $linkstart = ''; + $linkstart = ''; $linkend=''; $result .= $linkstart; diff --git a/htdocs/compta/bank/info.php b/htdocs/compta/bank/info.php index 7eaeb515aa9..ce9f2f5c2dc 100644 --- a/htdocs/compta/bank/info.php +++ b/htdocs/compta/bank/info.php @@ -45,7 +45,7 @@ $object->info($id); $h=0; -$head[$h][0] = DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$id; +$head[$h][0] = DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$id; $head[$h][1] = $langs->trans("Card"); $h++; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/line.php similarity index 98% rename from htdocs/compta/bank/ligne.php rename to htdocs/compta/bank/line.php index 4eb8a03ac64..2b04f83472f 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/line.php @@ -24,7 +24,7 @@ */ /** - * \file htdocs/compta/bank/ligne.php + * \file htdocs/compta/bank/line.php * \ingroup bank * \brief Page to edit a bank transaction record */ @@ -223,7 +223,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == else $sql.=", rappro = ".$rappro; $sql.= " WHERE rowid = ".$rowid; - dol_syslog("ligne.php", LOG_DEBUG); + dol_syslog("line.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -256,7 +256,7 @@ foreach ($cats as $cat) { $tabs = array( array( - DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$rowid, + DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$rowid, $langs->trans('Card') ), array( @@ -386,7 +386,7 @@ if ($result) print ''; } elseif ($links[$key]['type']=='payment_salary') { - print ''; + print ''; print img_object($langs->trans('ShowPaymentSalary'), 'payment').' '; print $langs->trans("SalaryPayment"); print ''; @@ -416,7 +416,7 @@ if ($result) print ''; } elseif ($links[$key]['type']=='banktransfert') { - print ''; + print ''; print img_object($langs->trans('ShowTransaction'), 'payment').' '; print $langs->trans("TransactionOnTheOtherAccount"); print ''; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index b6b4d3e2106..16b71dddc8f 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -616,7 +616,7 @@ else print ''.$type_label.' '.($objp->num_chq?$objp->num_chq:'').$link.''; // Description - print ''; + print ''; $reg=array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); @@ -778,7 +778,7 @@ else if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { - print ''; + print ''; print img_edit(); print ""; } diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 199b1f9c08d..05c1f3a1515 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -120,9 +120,9 @@ if ($action == 'add') if (! $error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amountto), '', '', $user); if (! ($bank_line_id_to > 0)) $error++; - if (! $error) $result=$accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert'); + if (! $error) $result=$accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); if (! ($result > 0)) $error++; - if (! $error) $result=$accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert'); + if (! $error) $result=$accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); if (! ($result > 0)) $error++; if (! $error) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index d31efcc9df8..b5473ddacb9 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -362,7 +362,7 @@ if ($id > 0 || $ref) print ""; print $ligne->LibStatut($obj->statut, 2); print " "; - print ''; + print ''; print sprintf("%06s", $obj->rowid); print ''; diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index c930db99012..0e4d28fde2f 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -203,7 +203,7 @@ if ($resql) print ''; - print ''; + print ''; print img_picto('', 'statut'.$obj->statut).' '; print substr('000000'.$obj->rowid, -6); print ''; diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/line.php similarity index 95% rename from htdocs/compta/prelevement/ligne.php rename to htdocs/compta/prelevement/line.php index 8b11716bf6f..c9004c04d26 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/line.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/compta/prelevement/ligne.php + * \file htdocs/compta/prelevement/line.php * \ingroup prelevement * \brief card of withdraw line */ @@ -86,7 +86,7 @@ if ($action == 'confirm_rejet') $rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int')); - header("Location: ligne.php?id=".$id); + header("Location: line.php?id=".$id); exit; } } @@ -97,7 +97,7 @@ if ($action == 'confirm_rejet') } else { - header("Location: ligne.php?id=".$id); + header("Location: line.php?id=".$id); exit; } } @@ -112,7 +112,7 @@ $invoicestatic=new Facture($db); llxHeader('', $langs->trans("StandingOrder")); $h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$id; +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id; $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; @@ -179,7 +179,7 @@ if ($id) $rej = new RejetPrelevement($db, $user); - print '
'; + print ''; print ''; print ''; print ''; @@ -231,7 +231,7 @@ if ($id) { if ($user->rights->prelevement->bons->credit) { - print "id\">".$langs->trans("StandingOrderReject").""; + print "id\">".$langs->trans("StandingOrderReject").""; } else { diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 81e58e19cca..dd53988d2ec 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -172,7 +172,7 @@ if ($result) print $ligne->LibStatut($obj->statut_ligne, 2); print " "; - print ''; + print ''; print substr('000000'.$obj->rowid_ligne, -6); print ''; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 333d07a4617..5d48cec2a75 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -100,7 +100,7 @@ if ($result) print '"; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 3bf047c87c8..85538fe9ea8 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -517,7 +517,7 @@ if ($resql) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''; print "\n"; @@ -596,7 +596,7 @@ if ($resql) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''; print "\n"; diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 861d7f737bb..922338999df 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -92,6 +92,7 @@ class CUnits // extends CommonObject if (isset($this->short_label)) $this->libelle=trim($this->short_label); if (isset($this->unit_type)) $this->active=trim($this->unit_type); if (isset($this->active)) $this->active=trim($this->active); + if (isset($this->scale)) $this->scale=trim($this->scale); // Check parameters // Put here code to add control on parameters values @@ -103,12 +104,14 @@ class CUnits // extends CommonObject $sql.= "label,"; $sql.= "short_label,"; $sql.= "unit_type"; + $sql.= "scale"; $sql.= ") VALUES ("; $sql.= " ".(! isset($this->id)?'NULL':"'".$this->db->escape($this->id)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").","; $sql.= " ".(! isset($this->short_label)?'NULL':"'".$this->db->escape($this->short_label)."'").","; $sql.= " ".(! isset($this->unit_type)?'NULL':"'".$this->db->escape($this->unit_type)."'"); + $sql.= " ".(! isset($this->scale)?'NULL':"'".$this->db->escape($this->scale)."'"); $sql.= ")"; $this->db->begin(); @@ -173,6 +176,7 @@ class CUnits // extends CommonObject $sql.= " t.label,"; $sql.= " t.short_label,"; $sql.= " t.unit_type,"; + $sql.= " t.scale,"; $sql.= " t.active"; $sql.= " FROM ".MAIN_DB_PREFIX."c_units as t"; $sql_where=array(); @@ -196,6 +200,7 @@ class CUnits // extends CommonObject $this->label = $obj->label; $this->short_label = $obj->short_label; $this->unit_type = $obj->unit_type; + $this->scale = $obj->scale; $this->active = $obj->active; } $this->db->free($resql); @@ -235,6 +240,7 @@ class CUnits // extends CommonObject $sql.= " t.label,"; $sql.= " t.short_label,"; $sql.= " t.unit_type,"; + $sql.= " t.scale,"; $sql.= " t.active"; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_units as t'; // Manage filter @@ -279,6 +285,7 @@ class CUnits // extends CommonObject $record->label = $obj->label; $record->short_label = $obj->short_label; $record->unit_type = $obj->unit_type; + $record->scale = $obj->scale; $record->active = $obj->active; $this->records[$record->id] = $record; } @@ -312,6 +319,7 @@ class CUnits // extends CommonObject if (isset($this->label)) $this->libelle=trim($this->label); if (isset($this->short_label)) $this->libelle=trim($this->short_label); if (isset($this->unit_type)) $this->libelle=trim($this->unit_type); + if (isset($this->scale)) $this->scale=trim($this->scale); if (isset($this->active)) $this->active=trim($this->active); // Check parameters @@ -323,6 +331,7 @@ class CUnits // extends CommonObject $sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").","; $sql.= " short_label=".(isset($this->short_label)?"'".$this->db->escape($this->short_label)."'":"null").","; $sql.= " unit_type=".(isset($this->unit_type)?"'".$this->db->escape($this->unit_type)."'":"null").","; + $sql.= " scale=".(isset($this->scale)?"'".$this->db->escape($this->scale)."'":"null").","; $sql.= " active=".(isset($this->active)?$this->active:"null"); $sql.= " WHERE rowid=".$this->id; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 11bfe9ff99f..24d73da5485 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1089,7 +1089,7 @@ function migrate_links_transfert($db, $langs, $conf) $sql.= "fk_bank, url_id, url, label, type"; $sql.= ")"; $sql.= " VALUES ("; - $sql.= $obj->barowid.",".$obj->bbrowid.", '/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert'"; + $sql.= $obj->barowid.",".$obj->bbrowid.", '/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'"; $sql.= ")"; print $sql.'
'; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index bfd1788e12f..2f44c6390ff 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -232,9 +232,9 @@ elseif ($event->type == 'payout.paid') { if (! $error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amount), '', '', $user); if (! ($bank_line_id_to > 0)) $error++; - if (! $error) $result=$accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert'); + if (! $error) $result=$accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); if (! ($result > 0)) $error++; - if (! $error) $result=$accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert'); + if (! $error) $result=$accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); if (! ($result > 0)) $error++; } diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index f94e182b010..fc90f37e5bf 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -421,6 +421,48 @@ class Contacts extends DolibarrApi return $this->_cleanObjectDatas($this->contact); } + /** + * Remove the link between a category and a contact + * + * @url DELETE {id}/categories/{category_id} + * + * @param int $id Id of contact + * @param int $category_id Id of category + * @return mixed + * + * @throws 401 RestException Insufficient rights + * @throws 401 RestException Access not allowed for login + * @throws 404 RestException Category not found + * @throws 404 RestException Contact not found + */ + public function deleteCategory($id, $category_id) + { + if(! DolibarrApiAccess::$user->rights->societe->contact->creer) { + throw new RestException(401, 'Insufficient rights'); + } + + $result = $this->contact->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Contact not found'); + } + $category = new Categorie($this->db); + $result = $category->fetch($category_id); + if( ! $result ) { + throw new RestException(404, 'category not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + if( ! DolibarrApi::_checkAccessToResource('category', $category->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $category->del_type($this->contact, 'contact'); + + return $this->_cleanObjectDatas($this->contact); + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas
'; print $ligne->LibStatut($obj->statut, 2).' '; - print ''; + print ''; print substr('000000'.$obj->rowid, -6)."'; + print ''; print $staticcontratligne->LibStatut($obj->statut, 3); print '
'; + print ''; print $staticcontratligne->LibStatut($obj->statut, 3, 1); print '