Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
345cd25613
@ -456,7 +456,7 @@ if ($result) {
|
||||
if ($objp->country_sell == '1') {
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
} elseif ($isinEEC == true) {
|
||||
} elseif ($isinEEC === true) {
|
||||
$objp->code_sell_p = $objp->code_sell_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
} else {
|
||||
|
||||
@ -154,6 +154,13 @@ if ($mode == 'setup' && $user->admin)
|
||||
$urltodelete='';
|
||||
$urltocheckperms='';
|
||||
}
|
||||
elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME='StripeLive';
|
||||
$urltorenew=$urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete='';
|
||||
$urltocheckperms='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$urltorenew='';
|
||||
|
||||
@ -920,6 +920,118 @@ class Invoices extends DolibarrApi
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a discount (credit available) for a credit note or a deposit.
|
||||
*
|
||||
* @param int $id Invoice ID
|
||||
* @url POST {id}/markAsCreditAvailable
|
||||
*
|
||||
* @return array An invoice object
|
||||
*
|
||||
* @throws 200
|
||||
* @throws 304
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function markAsCreditAvailable($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch_thirdparty();
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
}
|
||||
|
||||
if (! $this->invoice->paye) // protection against multiple submit
|
||||
{
|
||||
$this->invoice->fetch_lines();
|
||||
|
||||
// Loop on each vat rate
|
||||
$i=0;
|
||||
foreach($this->invoice->lines as $line)
|
||||
{
|
||||
$amount_ht[$line->tva_tx]+=$line->total_ht;
|
||||
$amount_tva[$line->tva_tx]+=$line->total_tva;
|
||||
$amount_ttc[$line->tva_tx]+=$line->total_ttc;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
if ($this->invoice->type == 2) $discount->description='(CREDIT_NOTE)';
|
||||
elseif ($this->invoice->type == 3) $discount->description='(DEPOSIT)';
|
||||
else {
|
||||
$this->error="CantConvertToReducAnInvoiceOfThisType";
|
||||
return -1;
|
||||
}
|
||||
$discount->tva_tx=abs($this->invoice->total_ttc);
|
||||
$discount->fk_soc=$this->invoice->socid;
|
||||
$discount->fk_facture_source=$this->invoice->id;
|
||||
|
||||
$error=0;
|
||||
foreach($amount_ht as $tva_tx => $xxx)
|
||||
{
|
||||
$discount->amount_ht=abs($amount_ht[$tva_tx]);
|
||||
$discount->amount_tva=abs($amount_tva[$tva_tx]);
|
||||
$discount->amount_ttc=abs($amount_ttc[$tva_tx]);
|
||||
$discount->tva_tx=abs($tva_tx);
|
||||
|
||||
$result=$discount->create(DolibarrApiAccess::$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Classe facture
|
||||
$result=$this->invoice->set_paid(DolibarrApiAccess::$user);
|
||||
if ($result > 0)
|
||||
{
|
||||
//$mesg='OK'.$discount->id;
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Could not set paid');
|
||||
$this->db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Discount creation error');
|
||||
$this->db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a discount line into an invoice (as an invoice line) using an existing absolute discount
|
||||
*
|
||||
|
||||
@ -301,7 +301,7 @@ if ($modecompta == 'BOOKKEEPING')
|
||||
// Get cpts of category/group
|
||||
$cpts = $AccCat->getCptsCat(0, $tmppredefinedgroupwhere);
|
||||
|
||||
foreach($cpts as $i => $cpt)
|
||||
foreach($cpts as $j => $cpt)
|
||||
{
|
||||
$return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']);
|
||||
if ($return < 0) {
|
||||
|
||||
@ -1563,14 +1563,14 @@ else
|
||||
print '<tr class="liste_titre'.($cursorline?' liste_titre_add':'').'">';
|
||||
print '<td>'.$langs->trans("ServiceNb", $cursorline).'</td>';
|
||||
print '<td width="80" align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td width="80" align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
print '<td width="80" class="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td width="80" align="right">'.$langs->trans("PriceUHTCurrency").'</td>';
|
||||
print '<td width="80" class="right">'.$langs->trans("PriceUHTCurrency").'</td>';
|
||||
}
|
||||
print '<td width="30" align="center">'.$langs->trans("Qty").'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td width="30" align="left">'.$langs->trans("Unit").'</td>';
|
||||
print '<td width="50" align="right">'.$langs->trans("ReductionShort").'</td>';
|
||||
if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print '<td width="50" align="right">'.$langs->trans("BuyingPrice").'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td width="30" class="left">'.$langs->trans("Unit").'</td>';
|
||||
print '<td width="50" class="right">'.$langs->trans("ReductionShort").'</td>';
|
||||
if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print '<td width="50" class="right">'.$langs->trans("BuyingPrice").'</td>';
|
||||
print '<td width="30"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1618,10 +1618,10 @@ else
|
||||
print vatrate($objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), '%', $objp->info_bits);
|
||||
print '</td>';
|
||||
// Price
|
||||
print '<td align="right">'.($objp->subprice != '' ? price($objp->subprice) : '')."</td>\n";
|
||||
print '<td class="right">'.($objp->subprice != '' ? price($objp->subprice) : '')."</td>\n";
|
||||
// Price multicurrency
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td align="right" class="linecoluht_currency nowrap">'.price($objp->multicurrency_subprice).'</td>';
|
||||
print '<td class="linecoluht_currency nowrap right">'.price($objp->multicurrency_subprice).'</td>';
|
||||
}
|
||||
// Quantite
|
||||
print '<td align="center">'.$objp->qty.'</td>';
|
||||
@ -1630,7 +1630,7 @@ else
|
||||
// Remise
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right">'.$objp->remise_percent."%</td>\n";
|
||||
print '<td class="right">'.$objp->remise_percent."%</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1641,7 +1641,7 @@ else
|
||||
if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print '<td align="right" class="nowrap">'.price($objp->pa_ht).'</td>';
|
||||
|
||||
// Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme)
|
||||
print '<td align="right" class="nowrap">';
|
||||
print '<td class="nowrap right">';
|
||||
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0))
|
||||
{
|
||||
print '<!-- link to move service line into another contract -->';
|
||||
@ -1746,10 +1746,10 @@ else
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<td class="right">';
|
||||
print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1);
|
||||
print '</td>';
|
||||
print '<td align="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||
print '<td class="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||
print '<td align="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
@ -1757,10 +1757,10 @@ else
|
||||
print $form->selectUnits($objp->fk_unit, "unit");
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right" class="nowrap"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
|
||||
print '<td class="nowrap right"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
|
||||
if (! empty($usemargins))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="right">';
|
||||
if ($objp->fk_product) print '<select id="fournprice" name="fournprice"></select>';
|
||||
print '<input id="buying_price" type="text" size="5" name="buying_price" value="'.price($objp->pa_ht, 0, '', 0).'"></td>';
|
||||
}
|
||||
@ -1880,7 +1880,7 @@ else
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).'</td>';
|
||||
print '<td width="30" align="right">';
|
||||
print '<td width="30" class="right">';
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline')
|
||||
|
||||
@ -189,7 +189,7 @@ foreach($listofstatus as $status)
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).'</a></td>';
|
||||
print '<td class="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($status==4 && ! $bool) $bool=true;
|
||||
@ -218,15 +218,15 @@ foreach($listofstatus as $status)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).'</a></td>';
|
||||
print '<td class="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).'</a></td>';
|
||||
if ($status==4 && ! $bool) $bool=true;
|
||||
else $bool=false;
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
//if ($totalinprocess != $total)
|
||||
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("ServicesRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
||||
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("ServicesRunning").')</td><td class="right">'.$totalinprocess.'</td></tr>';
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">'.$total.'</td></tr>';
|
||||
print "</table><br>";
|
||||
|
||||
|
||||
@ -332,7 +332,7 @@ if ($result)
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastContracts", 5).'</th>';
|
||||
print '<th align="center">'.$langs->trans("DateModification").'</th>';
|
||||
//print '<th align="left">'.$langs->trans("Status").'</th>';
|
||||
//print '<th class="left">'.$langs->trans("Status").'</th>';
|
||||
print '<th align="center" width="80" colspan="4">'.$langs->trans("Services").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -354,10 +354,10 @@ if ($result)
|
||||
print '</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->tms), 'dayhour').'</td>';
|
||||
//print '<td class="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0, 3):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4, 3, 0):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_expired>0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4, 3, 1):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5, 3):'').'</td>';
|
||||
print '<td class="right" width="32">'.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0, 3):'').'</td>';
|
||||
print '<td class="right" width="32">'.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4, 3, 0):'').'</td>';
|
||||
print '<td class="right" width="32">'.($obj->nb_expired>0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4, 3, 1):'').'</td>';
|
||||
print '<td class="right" width="32">'.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5, 3):'').'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
@ -432,7 +432,7 @@ if ($resql)
|
||||
$staticcompany->name=$obj->name;
|
||||
print $staticcompany->getNomUrl(1, '', 20);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" align="right"><a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print '<td class="nowrap right"><a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
$dateend=$db->jdate($obj->date_fin_validite);
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now)?1:0);
|
||||
print '</a></td>';
|
||||
@ -511,7 +511,7 @@ if ($resql)
|
||||
$staticcompany->name=$obj->name;
|
||||
print $staticcompany->getNomUrl(1, '', 20);
|
||||
print '</td>';
|
||||
print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print '<td width="16" class="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
@ -590,7 +590,7 @@ if ($resql)
|
||||
$staticcompany->name=$obj->name;
|
||||
print $staticcompany->getNomUrl(1, '', 20);
|
||||
print '</td>';
|
||||
print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print '<td width="16" class="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3, 1);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -559,7 +559,7 @@ if (! empty($arrayfields['lower_planned_end_date']['checked']))
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" colspan="4" align="right"></td>';
|
||||
print '<td class="liste_titre right" colspan="4"></td>';
|
||||
}
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
|
||||
@ -394,7 +394,7 @@ $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // N
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['cd.datec']['checked'])) print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['cd.tms']['checked'])) print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -511,7 +511,7 @@ if (! empty($arrayfields['cd.tms']['checked']))
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
// Status
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
$arrayofstatus=array(
|
||||
'0'=>$langs->trans("ServiceStatusInitial"),
|
||||
'4'=>$langs->trans("ServiceStatusRunning"),
|
||||
@ -523,7 +523,7 @@ if (! empty($arrayfields['status']['checked']))
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
@ -589,7 +589,7 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="right">';
|
||||
print price($obj->total_ht);
|
||||
print '</td>';
|
||||
$totalarray['totalht'] += $obj->total_ht;
|
||||
@ -601,7 +601,7 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="right">';
|
||||
print price($obj->total_tva);
|
||||
print '</td>';
|
||||
$totalarray['totalvat'] += $obj->total_tva;
|
||||
@ -613,14 +613,14 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
if (! empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="right">';
|
||||
print price2num($obj->tva_tx).'%';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="right">';
|
||||
print price($obj->subprice);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
@ -698,7 +698,7 @@ while ($i < min($num, $limit))
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="right">';
|
||||
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
|
||||
{
|
||||
print $contractstatic->LibStatut(0, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now));
|
||||
@ -735,9 +735,9 @@ if (isset($totalarray['displaytotalline'])) {
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
@ -51,7 +51,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
<td class="right"><?php
|
||||
// Price of contract is not shown by default because a contract is a list of service with
|
||||
// start and end date that change with time andd that may be different that the period of reference for price.
|
||||
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
||||
@ -64,8 +64,8 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
}
|
||||
echo price($totalcontrat);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(7); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
|
||||
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@ -425,7 +425,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir,
|
||||
print '</td>';*/
|
||||
|
||||
// Nb of docs
|
||||
print '<td align="right">';
|
||||
print '<td class="right">';
|
||||
print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:' ';
|
||||
print '</td>';
|
||||
print '<td class="left">';
|
||||
@ -433,19 +433,19 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir,
|
||||
print '</td>';
|
||||
|
||||
// Edit link
|
||||
print '<td align="right" width="18"><a href="';
|
||||
print '<td class="right" width="18"><a href="';
|
||||
print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'§ion='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
|
||||
print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
|
||||
print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
|
||||
|
||||
// Add link
|
||||
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
|
||||
//print '<td align="right" width="14"> </td>';
|
||||
//print '<td class="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
|
||||
//print '<td class="right" width="14"> </td>';
|
||||
|
||||
// Info
|
||||
if ($modulepart == 'ecm')
|
||||
{
|
||||
print '<td align="right" width="18">';
|
||||
print '<td class="right" width="18">';
|
||||
$userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
|
||||
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
|
||||
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2005-2012 Maxime Kohlhaas <mko@atm-consulting.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -117,6 +117,8 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
while ($line < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
$price = '';
|
||||
$price_base_type = '';
|
||||
|
||||
// Multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||
|
||||
@ -188,11 +188,10 @@ class FormCompany
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne.
|
||||
* Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
|
||||
* La cle de la liste est le code (il peut y avoir plusieurs entree pour
|
||||
* un code donnee mais dans ce cas, le champ pays differe).
|
||||
* Ainsi les liens avec les departements se font sur un departement independemment de son nom.
|
||||
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
|
||||
* In the case of an all-country list, the display breaks on the country.
|
||||
* The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
|
||||
* Thus the links with the departments are done on a department independently of its name.
|
||||
*
|
||||
* @param string $selected Code state preselected
|
||||
* @param int $country_codeid 0=list for all countries, otherwise country code or country rowid to show
|
||||
@ -207,11 +206,10 @@ class FormCompany
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne.
|
||||
* Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
|
||||
* La cle de la liste est le code (il peut y avoir plusieurs entree pour
|
||||
* un code donnee mais dans ce cas, le champ pays differe).
|
||||
* Ainsi les liens avec les departements se font sur un departement independemment de son nom.
|
||||
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
|
||||
* In the case of an all-country list, the display breaks on the country.
|
||||
* The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
|
||||
* Thus the links with the departments are done on a department independently of its name.
|
||||
*
|
||||
* @param string $selected Code state preselected (mus be state id)
|
||||
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
|
||||
|
||||
@ -1550,20 +1550,20 @@ class FormFile
|
||||
|
||||
// To show ref or specific information according to view to show (defined by $module)
|
||||
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
|
||||
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); }
|
||||
if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
|
||||
if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
|
||||
if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');}
|
||||
if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
|
||||
if ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');}
|
||||
elseif ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
|
||||
elseif ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
elseif ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
elseif ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
elseif ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
elseif ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
elseif ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||
elseif ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); }
|
||||
elseif ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
|
||||
elseif ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
|
||||
elseif ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');}
|
||||
elseif ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
|
||||
elseif ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');}
|
||||
|
||||
if (! $id && ! $ref) continue;
|
||||
$found=0;
|
||||
@ -1720,7 +1720,7 @@ class FormFile
|
||||
|
||||
print '<table width="100%" class="liste">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre(
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Links"),
|
||||
$_SERVER['PHP_SELF'],
|
||||
"name",
|
||||
@ -1730,7 +1730,7 @@ print_liste_field_titre(
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
print_liste_field_titre(
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
@ -1738,7 +1738,7 @@ print_liste_field_titre(
|
||||
"",
|
||||
'class="right"'
|
||||
);
|
||||
print_liste_field_titre(
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Date"),
|
||||
$_SERVER['PHP_SELF'],
|
||||
"date",
|
||||
@ -1748,7 +1748,7 @@ print_liste_field_titre(
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
print_liste_field_titre(
|
||||
'',
|
||||
$_SERVER['PHP_SELF'],
|
||||
"",
|
||||
@ -1825,7 +1825,7 @@ print_liste_field_titre(
|
||||
* @param array $file Array with data of file. Example: array('name'=>...)
|
||||
* @param string $modulepart propal, facture, facture_fourn, ...
|
||||
* @param string $relativepath Relative path of docs
|
||||
* @param string $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file)
|
||||
* @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file)
|
||||
* @param string $param More param on http links
|
||||
* @return string $out Output string with HTML
|
||||
*/
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015-2017 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015-2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -455,7 +455,7 @@ class FormMail extends Form
|
||||
}
|
||||
if (! empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this.
|
||||
{
|
||||
$out.= '<tr><td colspan="2" align="right">';
|
||||
$out.= '<tr><td colspan="2" class="right">';
|
||||
//$out.='<div class="floatright">';
|
||||
if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
|
||||
else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
|
||||
@ -1140,7 +1140,7 @@ class FormMail extends Form
|
||||
* @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
|
||||
* @param int $active 1=Only active template, 0=Only disabled, -1=All
|
||||
* @param string $label Label of template
|
||||
* @return ModelMail One instance of ModelMail
|
||||
* @return ModelMail|integer One instance of ModelMail or -1 if error
|
||||
*/
|
||||
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
|
||||
{
|
||||
|
||||
@ -223,16 +223,16 @@ class FormMargin
|
||||
print '<table class="noborder margintable centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans('Margins').'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('SellingPrice').'</td>';
|
||||
print '<td class="liste_titre right">'.$langs->trans('SellingPrice').'</td>';
|
||||
if ($conf->global->MARGIN_TYPE == "1")
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('BuyingPrice').'</td>';
|
||||
print '<td class="liste_titre right">'.$langs->trans('BuyingPrice').'</td>';
|
||||
else
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('CostPrice').'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('Margin').'</td>';
|
||||
print '<td class="liste_titre right">'.$langs->trans('CostPrice').'</td>';
|
||||
print '<td class="liste_titre right">'.$langs->trans('Margin').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('MarginRate').'</td>';
|
||||
print '<td class="liste_titre right">'.$langs->trans('MarginRate').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('MarkRate').'</td>';
|
||||
print '<td class="liste_titre right">'.$langs->trans('MarkRate').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->product->enabled))
|
||||
@ -240,13 +240,13 @@ class FormMargin
|
||||
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '<td class="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '<td class="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -254,13 +254,13 @@ class FormMargin
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('MarginOnServices').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '<td class="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '<td class="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -268,13 +268,13 @@ class FormMargin
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans('TotalMargin').'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td align="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>';
|
||||
print '<td class="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '<td class="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>';
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '<td class="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -101,7 +101,7 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
|
||||
sLink +
|
||||
fileName +
|
||||
'<\/a>' +
|
||||
'<\/td><td align="right" class="nowrap"> ' +
|
||||
'<\/td><td class="nowrap right"> ' +
|
||||
fileSize +
|
||||
' KB' +
|
||||
'<\/td><\/tr>' ;
|
||||
|
||||
@ -367,7 +367,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
$listofinsertedrowid[$cursorinsert]=$insertedrowid;
|
||||
dol_syslog('Admin.lib::run_sql Insert nb '.$cursorinsert.', done in table '.$table.', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG);
|
||||
}
|
||||
// print '<td align="right">OK</td>';
|
||||
// print '<td class="right">OK</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -410,13 +410,13 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
if ($error == 0)
|
||||
{
|
||||
if (! $silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>';
|
||||
if (! $silent) print '<td align="right">'.$langs->trans("OK").'</td></tr>'."\n";
|
||||
if (! $silent) print '<td class="right">'.$langs->trans("OK").'</td></tr>'."\n";
|
||||
$ok = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>';
|
||||
if (! $silent) print '<td align="right"><font class="error">'.$langs->trans("KO").'</font></td></tr>'."\n";
|
||||
if (! $silent) print '<td class="right"><font class="error">'.$langs->trans("KO").'</font></td></tr>'."\n";
|
||||
$ok = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ function show_array_actions_to_do($max = 5)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo", $max).'</th>';
|
||||
print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>';
|
||||
print '<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>';
|
||||
print '</tr>';
|
||||
|
||||
$var = true;
|
||||
@ -276,7 +276,7 @@ function show_array_actions_to_do($max = 5)
|
||||
$datep2=$db->jdate($obj->dp2);
|
||||
|
||||
// Date
|
||||
print '<td width="100" align="right">'.dol_print_date($datep, 'day').' ';
|
||||
print '<td width="100" class="right">'.dol_print_date($datep, 'day').' ';
|
||||
$late=0;
|
||||
if ($obj->percent == 0 && $datep && $datep < time()) $late=1;
|
||||
if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1;
|
||||
@ -286,7 +286,7 @@ function show_array_actions_to_do($max = 5)
|
||||
print "</td>";
|
||||
|
||||
// Statut
|
||||
print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent, 3)."</td>\n";
|
||||
print '<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -336,7 +336,7 @@ function show_array_last_actions_done($max = 5)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks", $max).'</th>';
|
||||
print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>';
|
||||
print '<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>';
|
||||
print '</tr>';
|
||||
$var = true;
|
||||
$i = 0;
|
||||
@ -369,11 +369,11 @@ function show_array_last_actions_done($max = 5)
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2), 'day');
|
||||
print '<td width="100" class="right">'.dol_print_date($db->jdate($obj->da2), 'day');
|
||||
print "</td>";
|
||||
|
||||
// Statut
|
||||
print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent, 3)."</td>\n";
|
||||
print "<td class=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent, 3)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
179
htdocs/core/modules/oauth/stripelive_oauthcallback.php
Normal file
179
htdocs/core/modules/oauth/stripelive_oauthcallback.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/oauth/stripe_oauthcallback.php
|
||||
* \ingroup oauth
|
||||
* \brief Page to get oauth callback
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
use OAuth\Common\Storage\DoliStorage;
|
||||
use OAuth\Common\Consumer\Credentials;
|
||||
use OAuth\OAuth2\Service\GitHub;
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtourl = GETPOST('backtourl', 'alpha');
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance of the URI class with the current URI, stripping the query string
|
||||
*/
|
||||
$uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
|
||||
//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
|
||||
//$currentUri->setQuery('');
|
||||
$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripe_oauthcallback.php');
|
||||
|
||||
|
||||
/**
|
||||
* Load the credential for the service
|
||||
*/
|
||||
|
||||
/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$httpClient = new \OAuth\Common\Http\Client\CurlClient();
|
||||
// TODO Set options for proxy and timeout
|
||||
// $params=array('CURLXXX'=>value, ...)
|
||||
//$httpClient->setCurlParameters($params);
|
||||
$serviceFactory->setHttpClient($httpClient);
|
||||
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_STRIPE_TEST_ID,
|
||||
$conf->global->STRIPE_LIVE_SECRET_KEY,
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
$requestedpermissionsarray=array();
|
||||
if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back
|
||||
/*if ($action != 'delete' && empty($requestedpermissionsarray))
|
||||
{
|
||||
print 'Error, parameter state is not defined';
|
||||
exit;
|
||||
}*/
|
||||
//var_dump($requestedpermissionsarray);exit;
|
||||
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
/** @var $apiService Service */
|
||||
//$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray);
|
||||
|
||||
$sql="INSERT INTO ".MAIN_DB_PREFIX."oauth_token set service='StripeLive', entity=".$conf->entity;
|
||||
$db->query($sql);
|
||||
|
||||
// access type needed to have oauth provider refreshing token
|
||||
//$apiService->setAccessType('offline');
|
||||
|
||||
$langs->load("oauth");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$storage->clearToken('StripeLive');
|
||||
|
||||
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
|
||||
|
||||
header('Location: ' . $backtourl);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (! empty($_GET['code'])) // We are coming from oauth provider page
|
||||
{
|
||||
// We should have
|
||||
//$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16))
|
||||
|
||||
dol_syslog("We are coming from the oauth provider page");
|
||||
//llxHeader('',$langs->trans("OAuthSetup"));
|
||||
|
||||
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
//print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
|
||||
|
||||
//dol_fiche_head();
|
||||
// retrieve the CSRF state parameter
|
||||
$state = isset($_GET['state']) ? $_GET['state'] : null;
|
||||
//print '<table>';
|
||||
|
||||
// This was a callback request from service, get the token
|
||||
try {
|
||||
//var_dump($_GET['code']);
|
||||
//var_dump($state);
|
||||
//var_dump($apiService); // OAuth\OAuth2\Service\GitHub
|
||||
|
||||
//$token = $apiService->requestAccessToken($_GET['code'], $state);
|
||||
$token = $apiService->requestAccessToken($_GET['code']);
|
||||
// Github is a service that does not need state to be stored.
|
||||
// Into constructor of GitHub, the call
|
||||
// parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
|
||||
// has not the ending parameter to true like the Google class constructor.
|
||||
|
||||
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
|
||||
|
||||
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
|
||||
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
|
||||
|
||||
header('Location: ' . $backtourl);
|
||||
exit();
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
}
|
||||
else // If entry on page with no parameter, we arrive here
|
||||
{
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
|
||||
|
||||
// This may create record into oauth_state before the header redirect.
|
||||
// Creation of record with state in this tables depend on the Provider used (see its constructor).
|
||||
if (GETPOST('state'))
|
||||
{
|
||||
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
|
||||
}
|
||||
else
|
||||
{
|
||||
//$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
//https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write
|
||||
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_LIVE_ID.'&scope=read_write';
|
||||
}
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
header('Location: ' . $url);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
// No view at all, just actions
|
||||
|
||||
$db->close();
|
||||
@ -300,7 +300,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -76,8 +77,14 @@ class Entrepot extends CommonObject
|
||||
*/
|
||||
public $address;
|
||||
|
||||
//! Code Postal
|
||||
/**
|
||||
* @var string Zipcode
|
||||
*/
|
||||
public $zip;
|
||||
|
||||
/**
|
||||
* @var string Town
|
||||
*/
|
||||
public $town;
|
||||
|
||||
/**
|
||||
@ -573,26 +580,26 @@ class Entrepot extends CommonObject
|
||||
{
|
||||
return $label;
|
||||
}
|
||||
if ($mode == 1)
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $label;
|
||||
}
|
||||
if ($mode == 2)
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut > 0) $picto = 'statut4';
|
||||
return img_picto($label, $picto).' '.$label;
|
||||
}
|
||||
if ($mode == 3)
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut > 0) $picto = 'statut4';
|
||||
return img_picto($label, $picto).' '.$label;
|
||||
}
|
||||
if ($mode == 4)
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut > 0) $picto = 'statut4';
|
||||
return img_picto($label, $picto).' '.$label;
|
||||
}
|
||||
if ($mode == 5)
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut > 0) $picto = 'statut4';
|
||||
return $label.' '.img_picto($label, $picto);
|
||||
@ -617,7 +624,6 @@ class Entrepot extends CommonObject
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$result='';
|
||||
$label = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("ShowWarehouse").'</u>';
|
||||
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref);
|
||||
@ -724,9 +730,9 @@ class Entrepot extends CommonObject
|
||||
/**
|
||||
* Return array of children warehouses ids from $id warehouse (recursive function)
|
||||
*
|
||||
* @param int $id id parent warehouse
|
||||
* @param array $TChildWarehouses array which will contain all children (param by reference)
|
||||
* @return array $TChildWarehouses array which will contain all children
|
||||
* @param int $id id parent warehouse
|
||||
* @param integer[] $TChildWarehouses array which will contain all children (param by reference)
|
||||
* @return integer[] $TChildWarehouses array which will contain all children
|
||||
*/
|
||||
function get_children_warehouses($id, &$TChildWarehouses)
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -80,22 +80,29 @@ if ($facid > 0)
|
||||
|
||||
if (! empty($conf->stripe->enabled))
|
||||
{
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha'))
|
||||
{
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = 0;
|
||||
}
|
||||
|
||||
$stripe=new Stripe($db);
|
||||
$stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here)
|
||||
access_forbidden();
|
||||
}
|
||||
|
||||
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))
|
||||
{
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = '0';
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = '1';
|
||||
}
|
||||
$stripeacc = $stripe->getStripeAccount($service);
|
||||
/*if (empty($stripeaccount))
|
||||
{
|
||||
print $langs->trans('ErrorStripeAccountNotDefined');
|
||||
}*/
|
||||
|
||||
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('paiementcard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Thibault FOUCART <support@ptibogxiv.net>
|
||||
/* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -71,7 +71,6 @@ else
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = '1';
|
||||
}
|
||||
|
||||
$stripeacc = $stripe->getStripeAccount($service);
|
||||
/*if (empty($stripeaccount))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user