This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class CL_BATCH_update_Purchases implements Database.Batchable<sObject> { | |
public CL_BATCH_update_Purchases(){} | |
global Database.QueryLocator start(Database.BatchableContext BC){ | |
String query='Select Id from SFDC_Purchase_Order__c'; | |
return Database.getQueryLocator(query); | |
} | |
global void execute(Database.BatchableContext BC,List<SFDC_Purchase_Order__c> scope){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class CL_Schedulable_update_Purchases implements Schedulable { | |
global void execute(SchedulableContext SC){ | |
CL_BATCH_update_Purchases batch_ordenes=new CL_BATCH_update_Purchases(); | |
Database.executeBatch(batch_ordenes); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date firstDayOfMonth = System.today().toStartOfMonth(); | |
Date lastDayOfMonth = firstDayOfMonth.addDays(Date.daysInMonth(firstDayOfMonth.year(), firstDayOfMonth.month()) - 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Class checkRecursive | |
{ | |
private static boolean run = true; | |
public static boolean runOnce(){ | |
if(run){ | |
run=false; | |
return true; | |
} | |
else | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteAccent(str){ | |
for (var i=0;i<str.length;i++){ | |
//Change "á é í ó ú" | |
if (str.charAt(i)=="á") str = str.replace(/á/,"a"); | |
if (str.charAt(i)=="é") str = str.replace(/é/,"e"); | |
if (str.charAt(i)=="í") str = str.replace(/í/,"i"); | |
if (str.charAt(i)=="ó") str = str.replace(/ó/,"o"); | |
if (str.charAt(i)=="ú") str = str.replace(/ú/,"u"); | |
} | |
return str; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:outputText value="{0, number, ###,###,###,##0.00}"> | |
<apex:param value="{!Opportunity.Amount}"/> | |
</apex:outputText> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CASE(MOD( StartDate__c - DATE(1985,6,24),7), | |
0 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,4,4,5,5,5,6,5,1), | |
1 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,4,4,4,5,4,6,5,1), | |
2 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,3,4,3,5,4,6,5,1), | |
3 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,2,3,2,4,3,5,4,6,5,1), | |
4 , CASE( MOD( EndDate__c - StartDate__c ,7),1,1,2,1,3,2,4,3,5,4,6,5,1), | |
5 , CASE( MOD( EndDate__c - StartDate__c ,7),1,0,2,1,3,2,4,3,5,4,6,5,0), | |
6 , CASE( MOD( EndDate__c - StartDate__c ,7),1,1,2,2,3,3,4,4,5,5,6,5,0), | |
999) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HashCodeGenerator{ | |
public static integer getHashCode(object obj){ | |
Map<string, integer> vals = new Map<string, integer>{'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15}; | |
string objJS = JSON.serialize(obj); | |
Blob b = Blob.valueOf(objJS); | |
Blob bHash = Crypto.generateMac('hmacSHA1', b, blob.valueOf('a key that does not matter')); | |
string objHex = EncodingUtil.convertToHex(bHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Inventario_de_Guardias__c" extensions="CM_GSM_Guard_Location"> | |
<head> | |
<title>Single marker</title> | |
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.css' rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
update account; | |
} | |
catch (DMLException e){ | |
ApexPages.addMessages(e); | |
Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage(); | |
String[] toAddresses = new String[] {'developer@acme.com'}; | |
mail.setToAddresses(toAddresses); | |
mail.setReplyTo('developer@acme.com'); |
OlderNewer