develop

Merge Cron module
This commit is contained in:
fhenry 2013-03-23 20:24:28 +01:00
commit d84cd86a50
31 changed files with 458 additions and 353 deletions

View File

@ -4,6 +4,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.4 compared to 3.3 ***** ***** ChangeLog for 3.4 compared to 3.3 *****
For users: For users:
- New: Support revenue stamp onto invoices.
- New: Add a tab "consumption" on thirdparties to list products bought/sells. - New: Add a tab "consumption" on thirdparties to list products bought/sells.
- New: Some performance enhancements. - New: Some performance enhancements.
- New: Can attach files onto trip and expenses modules. - New: Can attach files onto trip and expenses modules.

View File

@ -547,7 +547,7 @@ if ($action == 'edit' || $action == 'updateedit')
/* /*
* Local Taxes * Local Taxes
*/ */
if ($mysoc->hasLocalTax(1)) if ($mysoc->useLocalTax(1))
{ {
// Local Tax 1 // Local Tax 1
print '<br>'; print '<br>';
@ -579,7 +579,7 @@ if ($action == 'edit' || $action == 'updateedit')
print "</td></tr>\n"; print "</td></tr>\n";
print "</table>"; print "</table>";
} }
if ($mysoc->hasLocalTax(2)) if ($mysoc->useLocalTax(2))
{ {
// Local Tax 2 // Local Tax 2
print '<br>'; print '<br>';
@ -927,7 +927,7 @@ else
/* /*
* Local Taxes * Local Taxes
*/ */
if ($mysoc->hasLocalTax(1)) if ($mysoc->useLocalTax(1))
{ {
// Local Tax 1 // Local Tax 1
print '<br>'; print '<br>';
@ -960,7 +960,7 @@ else
print "</table>"; print "</table>";
} }
if ($mysoc->hasLocalTax(2)) if ($mysoc->useLocalTax(2))
{ {
// Local Tax 2 // Local Tax 2
print '<br>'; print '<br>';

View File

@ -1487,7 +1487,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
else else
{ {
print '<td colspan="2">'; print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1',1); print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print '</td>'; print '</td>';
} }
print '</tr>'."\n"; print '</tr>'."\n";

View File

@ -84,7 +84,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
if (! $error) if (! $error)
{ {
header('Location: '.DOL_URL_ROOT.'/compta/bank/rappro?account='.$id); // To avoid to submit twice and allow back header('Location: '.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$id); // To avoid to submit twice and allow back
exit; exit;
} }
} }

View File

@ -302,6 +302,14 @@ else if ($action == 'setpaymentterm' && $user->rights->facture->creer)
$result=$object->update($user); $result=$object->update($user);
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
else if ($action == 'setrevenuestamp' && $user->rights->facture->creer)
{
$object->fetch($id);
$object->revenuestamp=GETPOST('revenuestamp');
$result=$object->update($user);
$object->update_price(1);
if ($result < 0) dol_print_error($db,$object->error);
}
else if ($action == 'setremisepercent' && $user->rights->facture->creer) else if ($action == 'setremisepercent' && $user->rights->facture->creer)
{ {
$object->fetch($id); $object->fetch($id);
@ -1916,7 +1924,7 @@ if ($action == 'create')
else else
{ {
print '<td colspan="2">'; print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1',1); print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print '</td>'; print '</td>';
} }
print '</tr>'."\n"; print '</tr>'."\n";
@ -2284,11 +2292,12 @@ else if ($id > 0 || ! empty($ref))
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($object->socid); $soc->fetch($object->socid);
$selleruserevenustamp=$mysoc->useRevenueStamp();
$totalpaye = $object->getSommePaiement(); $totalpaye = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed(); $totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed(); $totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits; //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits." selleruserrevenuestamp=".$selleruserevenustamp;
// We can also use bcadd to avoid pb with floating points // We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0. // For example print 239.2 - 229.3 - 9.9; does not return 0.
@ -2752,10 +2761,9 @@ else if ($id > 0 || ! empty($ref))
$nbrows=8; $nbcols=2; $nbrows=8; $nbcols=2;
if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->projet->enabled)) $nbrows++;
if (! empty($conf->banque->enabled)) $nbcols++; if (! empty($conf->banque->enabled)) $nbcols++;
//Local taxes
if($mysoc->localtax1_assuj=="1") $nbrows++; if($mysoc->localtax1_assuj=="1") $nbrows++;
if($mysoc->localtax2_assuj=="1") $nbrows++; if($mysoc->localtax2_assuj=="1") $nbrows++;
if ($selleruserevenustamp) $nbrows++;
print '<td rowspan="'.$nbrows.'" colspan="2" valign="top">'; print '<td rowspan="'.$nbrows.'" colspan="2" valign="top">';
@ -3031,17 +3039,44 @@ else if ($id > 0 || ! empty($ref))
print '</tr>'; print '</tr>';
// Amount Local Taxes // Amount Local Taxes
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE if ($mysoc->localtax1_assuj=="1" && $mysoc->useLocalTax(1)) //Localtax1 (example RE)
{ {
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right" colspan="3" nowrap>'.price($object->total_localtax1,1,'',1,-1,-1,$conf->currency).'</td></tr>'; print '<td align="right" colspan="3" nowrap>'.price($object->total_localtax1,1,'',1,-1,-1,$conf->currency).'</td></tr>';
} }
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF if ($mysoc->localtax2_assuj=="1" && $mysoc->useLocalTax(2)) //Localtax2 (example IRPF)
{ {
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right" colspan="3" nowrap>'.price($object->total_localtax2,1,'',1,-1,-1,$conf->currency).'</td></tr>'; print '<td align="right" colspan="3" nowrap>'.price($object->total_localtax2,1,'',1,-1,-1,$conf->currency).'</td></tr>';
} }
// Revenue stamp
if ($selleruserevenustamp) // Test company use revenue stamp
{
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RevenueStamp');
print '</td>';
if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3" align="right">';
if ($action == 'editrevenuestamp')
{
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setrevenuestamp">';
print '<input type="text" class="flat" size="4" name="revenuestamp" value="'.price2num($object->revenuestamp).'">';
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
else
{
print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency);
}
print '</td></tr>';
}
// Total with tax
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="3" nowrap>'.price($object->total_ttc,1,'',1,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="3" nowrap>'.price($object->total_ttc,1,'',1,-1,-1,$conf->currency).'</td></tr>';
// Statut // Statut

View File

@ -75,6 +75,7 @@ class Facture extends CommonInvoice
var $total_ht=0; var $total_ht=0;
var $total_tva=0; var $total_tva=0;
var $total_ttc=0; var $total_ttc=0;
var $revenuestamp;
var $note; // deprecated var $note; // deprecated
var $note_private; var $note_private;
var $note_public; var $note_public;
@ -795,7 +796,8 @@ class Facture extends CommonInvoice
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise'; $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.datef as df'; $sql.= ', f.datef as df';
$sql.= ', f.date_lim_reglement as dlr'; $sql.= ', f.date_lim_reglement as dlr';
$sql.= ', f.datec as datec'; $sql.= ', f.datec as datec';
@ -841,6 +843,7 @@ class Facture extends CommonInvoice
$this->total_localtax1 = $obj->localtax1; $this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2; $this->total_localtax2 = $obj->localtax2;
$this->total_ttc = $obj->total_ttc; $this->total_ttc = $obj->total_ttc;
$this->revenuestamp = $obj->revenuestamp;
$this->paye = $obj->paye; $this->paye = $obj->paye;
$this->close_code = $obj->close_code; $this->close_code = $obj->close_code;
$this->close_note = $obj->close_note; $this->close_note = $obj->close_note;
@ -1050,6 +1053,7 @@ class Facture extends CommonInvoice
$sql.= " localtax2=".(isset($this->total_localtax2)?$this->total_localtax2:"null").","; $sql.= " localtax2=".(isset($this->total_localtax2)?$this->total_localtax2:"null").",";
$sql.= " total=".(isset($this->total_ht)?$this->total_ht:"null").","; $sql.= " total=".(isset($this->total_ht)?$this->total_ht:"null").",";
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").","; $sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
$sql.= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '')?$this->revenuestamp:"null").",";
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").","; $sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").","; $sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";

View File

@ -827,7 +827,7 @@ if ($action == 'create')
else else
{ {
print '<td colspan="2">'; print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1',1); print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print '</td>'; print '</td>';
} }
print '</tr>'."\n"; print '</tr>'."\n";

View File

@ -1556,6 +1556,9 @@ abstract class CommonObject
$i++; $i++;
} }
// Add revenue stamp to total
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
$this->db->free($resql); $this->db->free($resql);
// Now update global field total_ht, total_ttc and tva // Now update global field total_ht, total_ttc and tva

View File

@ -678,7 +678,7 @@ class Form
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id; if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id;
if ($filter) $sql.= " AND ".$filter; if ($filter) $sql.= " AND (".$filter.")";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " ORDER BY nom ASC"; $sql.= " ORDER BY nom ASC";

View File

@ -69,7 +69,7 @@ class FormCron extends Form
} }
}else { }else {
$out='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" />'; $out='<SELECT class="flat" name="'.$htmlname.'" id="'.$htmlname.'" />';
if ($selected=='command') { if ($selected=='command') {
$selected_attr=' selected=\"selected\" '; $selected_attr=' selected=\"selected\" ';

View File

@ -15,19 +15,18 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file cron/lib/cron.lib.php * \file cron/lib/cron.lib.php
* \brief Ensemble de fonctions de base pour le module jobs * \brief Function for module cron
* \ingroup jobs * \ingroup cron
*/ */
/** /**
* Return array of tabs to used on pages for third parties cards. * Return array of tabs to used on pages to setup cron module.
* *
* @param Object $object Object company shown
* @return array Array of tabs * @return array Array of tabs
*/ */
function cronadmin_prepare_head() function cronadmin_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
@ -35,7 +34,7 @@ function cronadmin_prepare_head()
$head = array(); $head = array();
$head[$h][0] = dol_buildpath('/cron/admin/cron.php', 1); $head[$h][0] = dol_buildpath('/cron/admin/cron.php', 1);
$head[$h][1] = $langs->trans("CronSetup"); $head[$h][1] = $langs->trans("Miscellanous");
$head[$h][2] = 'setup'; $head[$h][2] = 'setup';
$h++; $h++;
@ -47,6 +46,12 @@ function cronadmin_prepare_head()
return $head; return $head;
} }
/**
* Return array of tabs to used on a cron job
*
* @param Object $object Object cron
* @return array Array of tabs
*/
function cron_prepare_head($object) function cron_prepare_head($object)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
@ -59,7 +64,7 @@ function cron_prepare_head($object)
$h++; $h++;
$head[$h][0] = dol_buildpath('/cron/info.php', 1).'?id='.$object->id; $head[$h][0] = dol_buildpath('/cron/info.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("CronInfoPage"); $head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;

View File

@ -121,16 +121,16 @@ class doc_generic_invoice_odt extends ModelePDFFactures
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
'object_payment_term_code'=>$object->cond_reglement_code, 'object_payment_term_code'=>$object->cond_reglement_code,
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement), 'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
'object_total_ht'=>price2num($object->total_ht,2), 'object_total_ht'=>price2num($object->total_ht),
'object_total_vat'=>price2num($object->total_tva,2), 'object_total_vat'=>price2num($object->total_tva),
'object_total_ttc'=>price2num($object->total_ttc,2), 'object_total_ttc'=>price2num($object->total_ttc),
'object_total_discount_ht' => price2num($object->getTotalDiscount(), 0, $outputlangs), 'object_total_discount_ht' => price2num($object->getTotalDiscount(), 0, $outputlangs),
'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''), 'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''),
'object_note_private'=>$object->note, 'object_note_private'=>$object->note,
'object_note'=>$object->note_public, 'object_note'=>$object->note_public,
// Payments // Payments
'object_already_payed'=>$alreadypayed, 'object_already_payed'=>$alreadypayed,
'object_remain_to_pay'=>price2num($object->total_ttc - $sumpayed,2) 'object_remain_to_pay'=>price2num($object->total_ttc - $sumpayed)
); );
// Add vat by rates // Add vat by rates
@ -174,9 +174,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
'line_up'=>price($line->subprice, 0, $outputlangs), 'line_up'=>price($line->subprice, 0, $outputlangs),
'line_qty'=>$line->qty, 'line_qty'=>$line->qty,
'line_discount_percent'=>($line->remise_percent?$line->remise_percent.'%':''), 'line_discount_percent'=>($line->remise_percent?$line->remise_percent.'%':''),
'line_price_ht'=>price2num($line->total_ht, 2), 'line_price_ht'=>price2num($line->total_ht),
'line_price_ttc'=>price2num($line->total_ttc, 2), 'line_price_ttc'=>price2num($line->total_ttc),
'line_price_vat'=>price2num($line->total_tva, 2), 'line_price_vat'=>price2num($line->total_tva),
'line_date_start'=>dol_print_date($line->date_start, 'day', false, $outputlangs), 'line_date_start'=>dol_print_date($line->date_start, 'day', false, $outputlangs),
'line_date_end'=>dol_print_date($line->date_end, 'day', false, $outputlangs), 'line_date_end'=>dol_print_date($line->date_end, 'day', false, $outputlangs),
); );
@ -361,7 +361,6 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Fetch info for linked propal // Fetch info for linked propal
$linked_propal = $object->fetchObjectLinked('','','',''); $linked_propal = $object->fetchObjectLinked('','','','');
print '<pre>';
//print_r($object->linkedObjects['propal']); exit; //print_r($object->linkedObjects['propal']); exit;
$propal_object = $object->linkedObjects['propal'][0]; $propal_object = $object->linkedObjects['propal'][0];
@ -415,7 +414,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
$array_objet=$this->get_substitutionarray_object($object,$outputlangs); $array_objet=$this->get_substitutionarray_object($object,$outputlangs);
$array_propal=$this->get_substitutionarray_propal($propal_object,$outputlangs,'propal'); $array_propal=is_object($propal_object)?$this->get_substitutionarray_propal($propal_object,$outputlangs,'propal'):array();
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal); $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal);
complete_substitutions_array($tmparray, $outputlangs, $object); complete_substitutions_array($tmparray, $outputlangs, $object);

View File

@ -1020,6 +1020,17 @@ class pdf_crabe extends ModelePDFFactures
//} //}
} }
// Revenue stamp
if (price2num($object->revenuestamp) != 0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RevenueStamp"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->revenuestamp), $useborder, 'R', 1);
}
// Total TTC // Total TTC
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);

View File

@ -43,7 +43,7 @@ class modCron extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "technic"; $this->family = "base";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Enable the Dolibarr cron service"; $this->description = "Enable the Dolibarr cron service";
@ -72,7 +72,7 @@ class modCron extends DolibarrModules
//----------- //-----------
$this->const = array( $this->const = array(
0=>array( 0=>array(
'MAIN_CRON_KEY', 'CRON_KEY',
'chaine', 'chaine',
'', '',
'CRON KEY', 'CRON KEY',

View File

@ -1,28 +1,28 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.org> * Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file cron/admin/cron.php * \file cron/admin/cron.php
* \ingroup cron * \ingroup cron
*/ */
// Dolibarr environment // Dolibarr environment
$res = @include("../../main.inc.php"); // From htdocs directory $res = @include("../../main.inc.php"); // From htdocs directory
@ -44,7 +44,7 @@ if (!empty($actionsave))
$db->begin(); $db->begin();
$i+=dolibarr_set_const($db,'MAIN_CRON_KEY',trim(GETPOST("MAIN_CRON_KEY")),'chaine',0,'',0); $i+=dolibarr_set_const($db,'CRON_KEY',trim(GETPOST("CRON_KEY")),'chaine',0,'',0);
if ($i >= 1) if ($i >= 1)
{ {
@ -61,7 +61,7 @@ if (!empty($actionsave))
/* /*
* View * View
*/ */
llxHeader(); llxHeader();
@ -70,6 +70,7 @@ print_fiche_titre($langs->trans("CronSetup"),$linkback,'setup');
// Configuration header // Configuration header
$head = cronadmin_prepare_head(); $head = cronadmin_prepare_head();
dol_fiche_head($head,'setup',$langs->trans("Module2300Name"),0,'cron'); dol_fiche_head($head,'setup',$langs->trans("Module2300Name"),0,'cron');
print "<br>\n"; print "<br>\n";
@ -86,7 +87,7 @@ print "</tr>";
print '<tr class="impair">'; print '<tr class="impair">';
print '<td class="fieldrequired">'.$langs->trans("KeyForCronAccess").'</td>'; print '<td class="fieldrequired">'.$langs->trans("KeyForCronAccess").'</td>';
print '<td><input type="text" class="flat" id="MAIN_CRON_KEY" name="MAIN_CRON_KEY" value="'. (GETPOST('MAIN_CRON_KEY')?GETPOST('MAIN_CRON_KEY'):(! empty($conf->global->MAIN_CRON_KEY)?$conf->global->MAIN_CRON_KEY:'')) . '" size="40">'; print '<td><input type="text" class="flat" id="CRON_KEY" name="CRON_KEY" value="'. (GETPOST('CRON_KEY')?GETPOST('CRON_KEY'):(! empty($conf->global->CRON_KEY)?$conf->global->CRON_KEY:'')) . '" size="40">';
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
print '</td>'; print '</td>';
@ -101,38 +102,42 @@ print '</center>';
print '</form>'; print '</form>';
dol_fiche_end();
print '<br><br>'; print '<br><br>';
// 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
// Cron launch // Cron launch
print '<u>'.$langs->trans("URLToLaunchCronJobs").':</u><br>'; print '<u>'.$langs->trans("URLToLaunchCronJobs").':</u><br>';
$url=dol_buildpath('/public/cron/cron_run_jobs.php',1).(empty($conf->global->MAIN_CRON_KEY)?'':'?securitykey='.$conf->global->MAIN_CRON_KEY.'&').'userlogin='.$user->login; $url=$urlwithroot.'/public/cron/cron_run_jobs.php'.(empty($conf->global->CRON_KEY)?'':'?securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login;
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n"; print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
print ' '.$langs->trans("OrToLaunchASpecificJob").'<br>'; print ' '.$langs->trans("OrToLaunchASpecificJob").'<br>';
$url=dol_buildpath('/public/cron/cron_run_jobs.php',1).(empty($conf->global->MAIN_CRON_KEY)?'':'?securitykey='.$conf->global->MAIN_CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid'; $url=$urlwithroot.'/public/cron/cron_run_jobs.php'.(empty($conf->global->CRON_KEY)?'':'?securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid';
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n"; print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
print '<br>'; print '<br>';
print '<br>';
$linuxlike=1; $linuxlike=1;
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0; if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0; if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
print '<br>';
print '<u>'.$langs->trans("FileToLaunchCronJobs").':</u><br>';
$file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$user->login.' [cronjobid]';
print '<textarea rows="'.ROWS_2.'" cols="120">..'.$file."</textarea><br>\n";
print '<br>';
print $langs->trans("Note").': ';
if ($linuxlike) { if ($linuxlike) {
print $langs->trans("CronExplainHowToRunUnix"); print $langs->trans("CronExplainHowToRunUnix");
} else { } else {
print $langs->trans("CronExplainHowToRunWin"); print $langs->trans("CronExplainHowToRunWin");
} }
print '<br>';
print '<u>'.$langs->trans("FileToLaunchCronJobs").':</u><br>';
$file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->MAIN_CRON_KEY)?'securitykey':''.$conf->global->MAIN_CRON_KEY.'').' '.$user->login.' cronjobid(optionnal)';
if ($linuxlike) {
print 'user@host:'.DOL_DOCUMENT_ROOT.'$ php ..'.$file."<br>\n";
} else {
print DOL_DOCUMENT_ROOT.'> php ..'.$file."<br>\n";
}
print '<br>';
@ -149,7 +154,7 @@ if (! empty($conf->use_javascript_ajax))
generic: true generic: true
}, },
function(token) { function(token) {
$("#MAIN_CRON_KEY").val(token); $("#CRON_KEY").val(token);
}); });
}); });
});'; });';

View File

@ -187,9 +187,10 @@ if ($action=='inactive') {
} }
/* /*
* View * View
*/ */
llxHeader('',$langs->trans("CronAdd")); llxHeader('',$langs->trans("CronAdd"));
@ -243,9 +244,10 @@ if ($action == 'execute'){
/* /*
* Create Template * Create Template
*/ */
if (empty($object->status)) { if (empty($object->status) && $action != 'create')
{
dol_htmloutput_mesg($langs->trans("CronTaskInactive"),'','warning',1); dol_htmloutput_mesg($langs->trans("CronTaskInactive"),'','warning',1);
} }
@ -371,7 +373,6 @@ if (($action=="create") || ($action=="edit")) {
print "</td>"; print "</td>";
print "</tr>\n"; print "</tr>\n";
print '<tr class="blockmethod"><td>'; print '<tr class="blockmethod"><td>';
print $langs->trans('CronModule')."</td><td>"; print $langs->trans('CronModule')."</td><td>";
print "<input type=\"text\" size=\"20\" name=\"module_name\" value=\"".$object->module_name."\" /> "; print "<input type=\"text\" size=\"20\" name=\"module_name\" value=\"".$object->module_name."\" /> ";
@ -452,7 +453,7 @@ if (($action=="create") || ($action=="edit")) {
/* /*
* view Template * view Template
*/ */
// box add_jobs_box // box add_jobs_box
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -883,6 +883,7 @@ class Cronjob extends CommonObject
// Create Object for the call module // Create Object for the call module
$object = new $this->objectname($this->db); $object = new $this->objectname($this->db);
//Update launch start date //Update launch start date
$this->datelastrun=$now; $this->datelastrun=$now;
$this->nbrun=$this->nbrun+1; $this->nbrun=$this->nbrun+1;
@ -892,6 +893,7 @@ class Cronjob extends CommonObject
return -1; return -1;
} }
$params_arr = array(); $params_arr = array();
$params_arr=explode(", ",$this->params); $params_arr=explode(", ",$this->params);
if (!is_array($params_arr)) { if (!is_array($params_arr)) {
@ -944,7 +946,6 @@ class Cronjob extends CommonObject
return 1; return 1;
} }
} }
/** /**

View File

@ -1,13 +1,4 @@
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2012 Sebastian Neuwert <sebastian.neuwert@modula71.de>
-- Copyright (C) 2012 Ricardo Schluter <info@ripasch.nl>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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 -- it under the terms of the GNU General Public License as published by
@ -35,5 +26,5 @@
delete from llx_c_revenuestamp; delete from llx_c_revenuestamp;
-- TUNISIA -- -- TUNISIA (id country=10) --
insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1); insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, 0.4, 'Revenue stamp tunisia', 1);

View File

@ -219,13 +219,13 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 6
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 64, 6, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 64, 6, '0','0','VAT Rate 0', 1);
-- TUNISIA (id country=10) -- TUNISIA (id country=10)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (101,10, '6','0','VAT 6%', 1, 1, '4', 0.4, '7'); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (101,10, '6','0','VAT 6%', 1, 1, '4', 0, null);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (102,10, '12','0','VAT 12%',1, 1, '4', 0.4, '7'); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (102,10, '12','0','VAT 12%',1, 1, '4', 0, null);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (103,10, '18','0','VAT 18%',1, 1, '4', 0.4, '7'); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (103,10, '18','0','VAT 18%',1, 1, '4', 0, null);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1, 1, '4', 0.4, '7'); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1, 1, '4', 0, null);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1, 1, '4', 0.4, '7'); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1, 1, '4', 0, null);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1, 1, '4', 0.4, '7'); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1, 1, '4', 0, null);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (107,10, '0','0','VAT Rate 0', 1, 1, '4', 0.4, '7'); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (107,10, '0','0','VAT Rate 0', 1, 1, '4', 0, null);
-- UKRAINE (id country=226) -- UKRAINE (id country=226)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2261,226, '20','0','VAT standart rate',1); INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2261,226, '20','0','VAT standart rate',1);

View File

@ -130,8 +130,6 @@ CREATE TABLE llx_c_revenuestamp
insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1); insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1);
ALTER TABLE llx_actioncomm ADD COLUMN code varchar(32) NULL after fk_action;
ALTER TABLE llx_c_tva MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_c_tva MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0';
ALTER TABLE llx_c_tva MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_c_tva MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0';
ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0';
@ -148,6 +146,13 @@ ALTER TABLE llx_facturedet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEF
ALTER TABLE llx_facturedet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_facturedet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0';
ALTER TABLE llx_propaldet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_propaldet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0';
ALTER TABLE llx_propaldet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_propaldet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0';
-- No more use type 7, use revenuse stamp instead
UPDATE llx_c_tva set localtax1=0, localtax1_type='0' where localtax1_type = '7';
UPDATE llx_c_tva set localtax2=0, localtax2_type='0' where localtax2_type = '7';
ALTER TABLE llx_actioncomm ADD COLUMN code varchar(32) NULL after fk_action;
ALTER TABLE llx_holiday ADD COLUMN note text; ALTER TABLE llx_holiday ADD COLUMN note text;
ALTER TABLE llx_holiday ADD COLUMN note_public text; ALTER TABLE llx_holiday ADD COLUMN note_public text;
@ -197,5 +202,9 @@ ALTER TABLE llx_societe MODIFY COLUMN zip varchar(25);
ALTER TABLE llx_user ADD COLUMN address varchar(255); ALTER TABLE llx_user ADD COLUMN address varchar(255);
ALTER TABLE llx_user ADD COLUMN zip varchar(25); ALTER TABLE llx_user ADD COLUMN zip varchar(25);
ALTER TABLE llx_user ADD COLUMN town varchar(50); ALTER TABLE llx_user ADD COLUMN town varchar(50);
ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0; -- ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0;
ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0; ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0;

View File

@ -24,9 +24,9 @@ create table llx_c_tva
fk_pays integer NOT NULL, fk_pays integer NOT NULL,
taux double NOT NULL, taux double NOT NULL,
localtax1 double NOT NULL DEFAULT 0, localtax1 double NOT NULL DEFAULT 0,
localtax1_type varchar(10) NOT NULL DEFAULT '0', localtax1_type varchar(10) NOT NULL DEFAULT '0',
localtax2 double NOT NULL DEFAULT 0, localtax2 double NOT NULL DEFAULT 0,
localtax2_type varchar(10) NOT NULL DEFAULT '0', localtax2_type varchar(10) NOT NULL DEFAULT '0',
recuperableonly integer NOT NULL DEFAULT 0, recuperableonly integer NOT NULL DEFAULT 0,
note varchar(128), note varchar(128),
active tinyint DEFAULT 1 NOT NULL, active tinyint DEFAULT 1 NOT NULL,

View File

@ -390,6 +390,7 @@ AllCompletelyPayedInvoiceWillBeClosed=All invoice with no remain to pay will be
ToMakePayment=Pay ToMakePayment=Pay
ToMakePaymentBack=Pay back ToMakePaymentBack=Pay back
ListOfYourUnpaidInvoices=List of unpaid invoices ListOfYourUnpaidInvoices=List of unpaid invoices
RevenueStamp=Revenue stamp
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice
TypeContact_facture_external_BILLING=Customer invoice contact TypeContact_facture_external_BILLING=Customer invoice contact

View File

@ -387,6 +387,7 @@ AllCompletelyPayedInvoiceWillBeClosed=Toutes les factures avec un reste à payer
ToMakePayment=Payer ToMakePayment=Payer
ToMakePaymentBack=Rembourser ToMakePaymentBack=Rembourser
ListOfYourUnpaidInvoices=Liste des factures impayées ListOfYourUnpaidInvoices=Liste des factures impayées
RevenueStamp=Timbre fiscal
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Responsable suivi facture client TypeContact_facture_internal_SALESREPFOLL=Responsable suivi facture client
TypeContact_facture_external_BILLING=Contact client facturation TypeContact_facture_external_BILLING=Contact client facturation

View File

@ -9,8 +9,8 @@ URLToLaunchCronJobs=URL pour lancer les taches automatiques
OrToLaunchASpecificJob=Ou pour lancer une tache spécifique OrToLaunchASpecificJob=Ou pour lancer une tache spécifique
KeyForCronAccess=Clé de sécurité pour l'URL de lancement des taches automatiques KeyForCronAccess=Clé de sécurité pour l'URL de lancement des taches automatiques
FileToLaunchCronJobs=Commande pour lancer les taches automatiques FileToLaunchCronJobs=Commande pour lancer les taches automatiques
CronExplainHowToRunUnix=Sur un environement Unix vous pouvez paramétré CronTab pour executer cette commande toute les minutes CronExplainHowToRunUnix=Sur un environement Unix vous pouvez paramétrer CronTab pour executer cette commande toute les minutes.
CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez utilisr le planificateur de tache pour lancer cette commande toute les minutes CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez utiliser le planificateur de tache pour lancer cette commande toute les minutes.
# #
# Menu # Menu

View File

@ -157,7 +157,7 @@ ShowTypeCard=显示类型'%s'
HTPasswordExport=htpassword文件生成 HTPasswordExport=htpassword文件生成
NoThirdPartyAssociatedToMember=无关联的第三方该会员 NoThirdPartyAssociatedToMember=无关联的第三方该会员
ThirdPartyDolibarr=Dolibarr第三者 ThirdPartyDolibarr=Dolibarr第三者
MembersAndSubscriptions=议员和Suscriptions MembersAndSubscriptions=议员和Subscriptions
// STOP - Lines generated via autotranslator.php tool (2010-06-08 21:22:55). // STOP - Lines generated via autotranslator.php tool (2010-06-08 21:22:55).

View File

@ -49,7 +49,7 @@ if (empty($key)) {
echo 'securitykey is require'; echo 'securitykey is require';
exit; exit;
} }
if($key != $conf->global->MAIN_CRON_KEY) if($key != $conf->global->CRON_KEY)
{ {
echo 'securitykey is wrong'; echo 'securitykey is wrong';
exit; exit;

View File

@ -83,6 +83,8 @@ class Societe extends CommonObject
var $idprof2; // IdProf2 (Ex: Siret in France) var $idprof2; // IdProf2 (Ex: Siret in France)
var $idprof3; // IdProf3 (Ex: Ape in France) var $idprof3; // IdProf3 (Ex: Ape in France)
var $idprof4; // IdProf4 (Ex: RCS in France) var $idprof4; // IdProf4 (Ex: RCS in France)
var $idprof5; // IdProf5
var $idprof6; // IdProf6
var $prefix_comm; var $prefix_comm;
@ -2599,40 +2601,53 @@ class Societe extends CommonObject
} }
/** /**
* Check if localtax define for company * Check if thirdparty may using localtax or not
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
* *
* @param localTaxNum $localTaxNum 1 or 2 * @param int $localTaxNum To get info for only localtax1 or localtax2
* @return boolean true / false * @return array array(0=>boolean, 1=>boolean)
*/ */
function hasLocalTax($localTaxNum) { function useLocalTax($localTaxNum=0)
global $user,$langs,$conf; {
$sql = "SELECT t.localtax1, t.localtax2";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$this->country_code."'";
$sql .= " AND t.active = 1";
if (empty($localTaxNum)) $sql .= " AND (t.localtax1_type <> '0' OR t.localtax2_type <> '0')";
elseif ($localTaxNum == 1) $sql .= " AND t.localtax1_type <> '0'";
elseif ($localTaxNum == 2) $sql .= " AND t.localtax2_type <> '0'";
// check parameter dol_syslog("useLocalTax sql=".$sql);
if ($localTaxNum != 1 && $localTaxNum != 2) $resql=$this->db->query($sql);
return false; if ($resql)
{
return ($this->db->num_rows($resql) > 0);
}
else return false;
}
// Search local taxes /**
$sql = "SELECT t.localtax1, t.localtax2"; * Check if thirdparty is from a country using revenue stamps
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; *
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$this->country_code."'"; * @return boolean Yes or no
$sql .= " AND t.active = 1"; */
if ($localTaxNum == 1) function useRevenueStamp()
$sql .= " AND t.localtax1 <> 0"; {
elseif ($localTaxNum == 2) $sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."c_revenuestamp as r, ".MAIN_DB_PREFIX."c_pays as p";
$sql .= " AND t.localtax2 <> 0"; $sql .= " WHERE r.fk_pays = p.rowid AND p.code = '".$this->country_code."'";
$sql .= " AND r.active = 1";
dol_syslog("get_localtax sql=".$sql); dol_syslog("useRevenueStamp sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
return ($this->db->num_rows($resql) > 0); $obj=$this->db->fetch_object($resql);
return (($obj->nb > 0)?true:false);
} }
else else
return false; {
$this->error=$this->db->lasterror();
return false;
}
} }
/** /**
@ -2752,7 +2767,7 @@ class Societe extends CommonObject
/** /**
* Set commnunication level * Set commnunication level
* *
* @param User $user Utilisateur qui definie la remise * @param User $user User making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_commnucation_level($user) function set_commnucation_level($user)

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

@ -912,6 +912,11 @@ class User extends CommonObject
$this->office_phone = $contact->phone_pro; $this->office_phone = $contact->phone_pro;
$this->office_fax = $contact->fax; $this->office_fax = $contact->fax;
$this->user_mobile = $contact->phone_mobile; $this->user_mobile = $contact->phone_mobile;
$this->address = $contact->address;
$this->zip = $contact->zip;
$this->town = $contact->town;
$this->state_id = $contact->state_id;
$this->country_id = $contact->country_id;
if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4));
$this->login = $login; $this->login = $login;
@ -974,11 +979,16 @@ class User extends CommonObject
// Positionne parametres // Positionne parametres
$this->admin = 0; $this->admin = 0;
$this->lastname = $member->lastname; $this->lastname = $member->lastname;
$this->firstname = $member->firstname; $this->firstname = $member->firstname;
$this->email = $member->email; $this->email = $member->email;
$this->fk_member = $member->id; $this->fk_member = $member->id;
$this->pass = $member->pass; $this->pass = $member->pass;
$this->address = $member->address;
$this->zip = $member->zip;
$this->town = $member->town;
$this->state_id = $member->state_id;
$this->country_id = $member->country_id;
if (empty($login)) $login=strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4)); if (empty($login)) $login=strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4));
$this->login = $login; $this->login = $login;
@ -1120,6 +1130,11 @@ class User extends CommonObject
$sql.= ", firstname = '".$this->db->escape($this->firstname)."'"; $sql.= ", firstname = '".$this->db->escape($this->firstname)."'";
$sql.= ", login = '".$this->db->escape($this->login)."'"; $sql.= ", login = '".$this->db->escape($this->login)."'";
$sql.= ", admin = ".$this->admin; $sql.= ", admin = ".$this->admin;
$sql.= ", address = '".$this->db->escape($this->address)."'";
$sql.= ", zip = '".$this->db->escape($this->zip)."'";
$sql.= ", town = '".$this->db->escape($this->town)."'";
$sql.= ", fk_state = '".$this->db->escape($this->state_id)."'";
$sql.= ", fk_country = '".$this->db->escape($this->country_id)."'";
$sql.= ", office_phone = '".$this->db->escape($this->office_phone)."'"; $sql.= ", office_phone = '".$this->db->escape($this->office_phone)."'";
$sql.= ", office_fax = '".$this->db->escape($this->office_fax)."'"; $sql.= ", office_fax = '".$this->db->escape($this->office_fax)."'";
$sql.= ", user_mobile = '".$this->db->escape($this->user_mobile)."'"; $sql.= ", user_mobile = '".$this->db->escape($this->user_mobile)."'";

62
scripts/cron/cron_run_jobs.php Normal file → Executable file
View File

@ -27,9 +27,10 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOLOGIN')) define('NOLOGIN','1'); if (! defined('NOLOGIN')) define('NOLOGIN','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();
$script_file = basename(__FILE__); $script_file = basename(__FILE__);
$path=dirname(__FILE__).'/'; $path=dirname(__FILE__).'/';
@ -53,46 +54,47 @@ if (! isset($argv[2]) || ! $argv[2]) {
$userlogin=$argv[2]; $userlogin=$argv[2];
} }
require_once ($path."../../htdocs/master.inc.php");
$res=@include("../../master.inc.php"); // For root directory require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php");
if (! $res) $res=@include("../../../master.inc.php"); // For "custom" directory require_once (DOL_DOCUMENT_ROOT.'/user/class/user.class.php');
if (! $res) die("Include of master.inc.php fails"); require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php");
// librarie jobs /*
require_once (DOL_DOCUMENT_ROOT_ALT."/cron/class/cronjob.class.php"); * Main
*/
// Check security key
//Check security key if ($key != $conf->global->CRON_KEY)
if($key != $conf->global->MAIN_CRON_KEY)
{ {
echo 'securitykey is wrong'; print "Error: securitykey is wrong\n";
exit; exit;
} }
//Check user login // Check user login
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$user=new User($db); $user=new User($db);
$result=$user->fetch('',$userlogin); $result=$user->fetch('',$userlogin);
if ($result<0) { if ($result < 0)
echo "User Error:".$user->error; {
echo "User Error: ".$user->error;
dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
exit; exit;
}else { }
if (empty($user->id)) { else
echo " User user login:".$userlogin." do not exists"; {
if (empty($user->id))
{
echo " User user login: ".$userlogin." do not exists";
dol_syslog(" User user login:".$userlogin." do not exists", LOG_ERR); dol_syslog(" User user login:".$userlogin." do not exists", LOG_ERR);
exit; exit;
} }
} }
if (isset($argv[3]) || $argv[3]) { if (isset($argv[3]) || $argv[3])
{
$id = $argv[3]; $id = $argv[3];
} }
// librarie jobs
require_once (DOL_DOCUMENT_ROOT_ALT."/cron/class/cronjob.class.php");
// create a jobs object // create a jobs object
$object = new Cronjob($db); $object = new Cronjob($db);
@ -103,18 +105,21 @@ if (empty($id)) {
} }
$result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter); $result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter);
if ($result<0) { if ($result<0)
echo "Error:".$cronjob->error; {
dol_syslog("cron_run_jobs.php:: fetch Error".$cronjob->error, LOG_ERR); echo "Error: ".$object->error;
dol_syslog("cron_run_jobs.php:: fetch Error ".$object->error, LOG_ERR);
exit; exit;
} }
// current date // current date
$now=dol_now(); $now=dol_now();
if(is_array($object->lines) && (count($object->lines)>0)){ if(is_array($object->lines) && (count($object->lines)>0))
{
// Loop over job // Loop over job
foreach($object->lines as $line){ foreach($object->lines as $line)
{
//If date_next_jobs is less of current dat, execute the program, and store the execution time of the next execution in database //If date_next_jobs is less of current dat, execute the program, and store the execution time of the next execution in database
if (($line->datenextrun < $now) && $line->dateend < $now){ if (($line->datenextrun < $now) && $line->dateend < $now){
@ -144,3 +149,6 @@ if(is_array($object->lines) && (count($object->lines)>0)){
} }
} }
} }
$db->close();
?>