This commit is contained in:
Laurent Destailleur 2019-07-22 18:50:17 +02:00
commit 4833c2bf49
16 changed files with 82 additions and 31 deletions

View File

@ -1116,7 +1116,7 @@ if ($resql)
if (! empty($arrayfields['b.rowid']['checked']))
{
print '<td class="nowrap left">';
print "<a href=\"ligne.php?rowid=".$objp->rowid.'&save_lastsearch_values=1">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> &nbsp; ";
print "<a href=\"line.php?rowid=".$objp->rowid.'&save_lastsearch_values=1">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> &nbsp; ";
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
@ -1126,7 +1126,7 @@ if ($resql)
{
print "<td>";
//print "<a href=\"ligne.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">";
//print "<a href=\"line.php?rowid=".$objp->rowid."&amp;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 '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print img_edit();
print '</a>';
}
@ -1467,13 +1467,13 @@ if ($resql)
{
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
{
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print img_edit();
print '</a>';
}
else
{
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print img_view();
print '</a>';
}

View File

@ -2277,7 +2277,7 @@ class AccountLine extends CommonObject
$result='';
$label=$langs->trans("ShowTransaction").': '.$this->rowid;
$linkstart = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkstart = '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$result .= $linkstart;

View File

@ -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++;

View File

@ -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 '</a>';
}
elseif ($links[$key]['type']=='payment_salary') {
print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">';
print '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPaymentSalary'), 'payment').' ';
print $langs->trans("SalaryPayment");
print '</a>';
@ -416,7 +416,7 @@ if ($result)
print '</a>';
}
elseif ($links[$key]['type']=='banktransfert') {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowTransaction'), 'payment').' ';
print $langs->trans("TransactionOnTheOtherAccount");
print '</a>';

View File

@ -616,7 +616,7 @@ else
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').$link.'</td>';
// Description
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'">';
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'">';
$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 '<td class="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?account='.$object->id.'&num='.$numref).'">';
print '<td class="center"><a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?account='.$object->id.'&num='.$numref).'">';
print img_edit();
print "</a></td>";
}

View File

@ -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)

View File

@ -362,7 +362,7 @@ if ($id > 0 || $ref)
print "<td>";
print $ligne->LibStatut($obj->statut, 2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print sprintf("%06s", $obj->rowid);
print '</a></td>';

View File

@ -203,7 +203,7 @@ if ($resql)
print '<tr class="oddeven"><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print img_picto('', 'statut'.$obj->statut).' ';
print substr('000000'.$obj->rowid, -6);
print '</a></td>';

View File

@ -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 '<form name="confirm_rejet" method="post" action="ligne.php?id='.$id.'">';
print '<form name="confirm_rejet" method="post" action="line.php?id='.$id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="confirm_rejet">';
print '<table class="border" width="100%">';
@ -231,7 +231,7 @@ if ($id)
{
if ($user->rights->prelevement->bons->credit)
{
print "<a class=\"butAction\" href=\"ligne.php?action=rejet&amp;id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>";
print "<a class=\"butAction\" href=\"line.php?action=rejet&amp;id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>";
}
else
{

View File

@ -172,7 +172,7 @@ if ($result)
print $ligne->LibStatut($obj->statut_ligne, 2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid_ligne.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6);
print '</a></td>';

View File

@ -100,7 +100,7 @@ if ($result)
print '<tr class="oddeven"><td>';
print $ligne->LibStatut($obj->statut, 2).'&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print substr('000000'.$obj->rowid, -6)."</a></td>";

View File

@ -517,7 +517,7 @@ if ($resql)
$staticcompany->name=$obj->name;
print $staticcompany->getNomUrl(1, '', 20);
print '</td>';
print '<td width="16" class="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
print '<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
print $staticcontratligne->LibStatut($obj->statut, 3);
print '</a></td>';
print "</tr>\n";
@ -596,7 +596,7 @@ if ($resql)
$staticcompany->name=$obj->name;
print $staticcompany->getNomUrl(1, '', 20);
print '</td>';
print '<td width="16" class="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
print '<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
print $staticcontratligne->LibStatut($obj->statut, 3, 1);
print '</a></td>';
print "</tr>\n";

View File

@ -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;

View File

@ -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.'<br>';

View File

@ -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++;
}

View File

@ -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